Skip to content

Commit

Permalink
test: breaking change revert adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Aug 27, 2021
1 parent 40e4307 commit 1ef8cb6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/execution/__tests__/abstract-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,14 @@ describe('Execute: Handles execution of abstract types', () => {
};
}

function expectNoError({ forTypeName }: { forTypeName: unknown }) {
const rootValue = { pet: { __typename: forTypeName } };
const result = executeSync({ schema, document, rootValue });
expect(result).to.deep.equal({
data: { pet: null },
});
}

expectError({ forTypeName: undefined }).toEqual(
'Abstract type "Pet" must resolve to an Object type at runtime for field "Query.pet". Either the "Pet" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.',
);
Expand Down Expand Up @@ -580,8 +588,6 @@ describe('Execute: Handles execution of abstract types', () => {
// @ts-expect-error
assertInterfaceType(schema.getType('Pet')).resolveType = () =>
schema.getType('Cat');
expectError({ forTypeName: undefined }).toEqual(
'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.',
);
expectNoError({ forTypeName: undefined });
});
});

0 comments on commit 1ef8cb6

Please sign in to comment.