Skip to content

Commit

Permalink
astFromValue fails with a custom scalar serializing to an object value
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed May 8, 2024
1 parent d811c97 commit 495f5b5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utilities/__tests__/astFromValue-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,24 @@ describe('astFromValue', () => {
expect(() => astFromValue('value', returnCustomClassScalar)).to.throw(
'Cannot convert value to AST: {}.',
);

const returnObjectScalar = new GraphQLScalarType({
name: 'ReturnObjectScalar',
serialize() {
return { some: 'data' };
},
});

expect(astFromValue('value', returnObjectScalar)).to.deep.equal({
kind: 'ObjectValue',
fields: [
{
kind: 'ObjectField',
name: { kind: 'Name', value: 'some' },
value: { kind: 'StringValue', value: 'data' },
},
],
});
});

it('does not converts NonNull values to NullValue', () => {
Expand Down

0 comments on commit 495f5b5

Please sign in to comment.