Skip to content

Commit 9a571ef

Browse files
committed
test: astFromValue converts input objects with explicit nulls
1 parent 61385b7 commit 9a571ef

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/utilities/__tests__/astFromValue-test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,26 @@ describe('astFromValue', () => {
245245
value: { kind: 'EnumValue', value: 'HELLO' } } ] }
246246
);
247247
});
248+
249+
it('converts input objects with explicit nulls', () => {
250+
const inputObj = new GraphQLInputObjectType({
251+
name: 'MyInputObj',
252+
fields: {
253+
foo: { type: GraphQLFloat },
254+
bar: { type: myEnum },
255+
}
256+
});
257+
258+
expect(astFromValue(
259+
{ foo: null },
260+
inputObj
261+
)).to.deep.equal(
262+
{ kind: 'ObjectValue',
263+
fields: [
264+
{ kind: 'ObjectField',
265+
name: { kind: 'Name', value: 'foo' },
266+
value: { kind: 'NullValue' } } ] }
267+
);
268+
});
269+
248270
});

0 commit comments

Comments
 (0)