Skip to content

Commit

Permalink
resolveType: add workaround for transformed schemas (graphql#2793)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Sep 5, 2020
1 parent 64a5c34 commit d6e760c
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 320 deletions.
11 changes: 5 additions & 6 deletions src/__tests__/starWarsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,11 @@ const characterInterface = new GraphQLInterfaceType({
},
}),
resolveType(character) {
if (character.type === 'Human') {
return humanType;
}
// istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
if (character.type === 'Droid') {
return droidType;
switch (character.type) {
case 'Human':
return humanType.name;
case 'Droid':
return droidType.name;
}

// istanbul ignore next (Not reachable. All possible types have been considered)
Expand Down
Loading

0 comments on commit d6e760c

Please sign in to comment.