Skip to content

Commit ead21ce

Browse files
committed
astFromValue fails with a custom scalar serializing to an object value
1 parent d811c97 commit ead21ce

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/utilities/__tests__/astFromValue-test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ describe('astFromValue', () => {
233233
expect(() => astFromValue('value', returnCustomClassScalar)).to.throw(
234234
'Cannot convert value to AST: {}.',
235235
);
236+
237+
const returnObjectScalar = new GraphQLScalarType({
238+
name: 'ReturnObjectScalar',
239+
serialize() {
240+
return { some: 'data' };
241+
},
242+
});
243+
244+
expect(astFromValue('value', returnObjectScalar)).to.deep.equal({
245+
kind: 'ObjectValue',
246+
fields: [{ kind: 'ObjectField', name: { kind: 'Name', value: 'some' }, value: { kind: 'StringValue', value: 'data' } }],
247+
});
236248
});
237249

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

0 commit comments

Comments
 (0)