Skip to content

Commit 2cd4878

Browse files
committed
feat(Input Coercion Tests): Updates test to support proper nested input coercion
1 parent 45e9ebe commit 2cd4878

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/utilities/__tests__/coerceInputValue-test.ts

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,46 @@ describe('coerceInputValue', () => {
395395
expectValue(result).to.deep.equal(null);
396396
});
397397

398-
it('returns nested lists for nested non-list values', () => {
398+
it('returns error for nested non-list values', () => {
399399
const result = coerceValue([1, 2, 3], TestNestedList);
400-
expectValue(result).to.deep.equal([[1], [2], [3]]);
400+
expectErrors(result).to.deep.equal([
401+
{
402+
error: 'Expected type "[Int]" to be a list.',
403+
path: [0],
404+
value: 1,
405+
},
406+
{
407+
error: 'Expected type "[Int]" to be a list.',
408+
path: [1],
409+
value: 2,
410+
},
411+
{
412+
error: 'Expected type "[Int]" to be a list.',
413+
path: [2],
414+
value: 3,
415+
},
416+
]);
401417
});
402418

403-
it('returns nested null for nested null values', () => {
419+
it('returns errors for null values', () => {
404420
const result = coerceValue([42, [null], null], TestNestedList);
405-
expectValue(result).to.deep.equal([[42], [null], null]);
421+
expectErrors(result).to.deep.equal([
422+
{
423+
error: 'Expected type "[Int]" to be a list.',
424+
path: [0],
425+
value: 42,
426+
},
427+
{
428+
error: 'Expected type "[Int]" to be a list.',
429+
path: [2],
430+
value: null,
431+
},
432+
]);
433+
});
434+
435+
it('returns nested null for nested null values', () => {
436+
const result = coerceValue([[null], [null]], TestNestedList);
437+
expectValue(result).to.deep.equal([[null], [null]]);
406438
});
407439
});
408440

0 commit comments

Comments
 (0)