Skip to content

Commit 495f5b5

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

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/utilities/__tests__/astFromValue-test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,24 @@ 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: [
247+
{
248+
kind: 'ObjectField',
249+
name: { kind: 'Name', value: 'some' },
250+
value: { kind: 'StringValue', value: 'data' },
251+
},
252+
],
253+
});
236254
});
237255

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

0 commit comments

Comments
 (0)