Skip to content

Commit

Permalink
Fixed test for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelCastillo committed Nov 12, 2021
1 parent 590bbd4 commit 02ea591
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions plugin/federation/federation_entityresolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ func TestEntityResolver(t *testing.T) {
entityErrors, err := getEntityErrors(err)
require.NoError(t, err)
require.Len(t, entityErrors, 2)
require.Equal(t, entityErrors[0].Message, "error resolving HelloWithErrorsByName. empty key")
require.Equal(t, entityErrors[1].Message, "error resolving HelloWithErrorsByName")
errMessages := []string{
entityErrors[0].Message,
entityErrors[1].Message,
}

require.Contains(t, errMessages, "error (empty key) resolving HelloWithErrorsByName")
require.Contains(t, errMessages, "error resolving HelloWithErrorsByName")

require.Len(t, resp.Entities, 5)
require.Equal(t, resp.Entities[0].Name, "first name - 1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (r *entityResolver) FindHelloWithErrorsByName(ctx context.Context, name str
if name == "inject error" {
return nil, fmt.Errorf("error resolving HelloWithErrorsByName")
} else if name == "" {
return nil, fmt.Errorf("error resolving HelloWithErrorsByName. empty key")
return nil, fmt.Errorf("error (empty key) resolving HelloWithErrorsByName")
}

return &generated.HelloWithErrors{
Expand Down

0 comments on commit 02ea591

Please sign in to comment.