Skip to content

Commit f84a7df

Browse files
committed
Add test for input arguments being deprecated
1 parent a22962e commit f84a7df

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/utilities/__tests__/buildASTSchema-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,19 @@ describe('Schema Builder', () => {
627627
OTHER_VALUE @deprecated(reason: "Terrible reasons")
628628
}
629629
630+
input MyInput {
631+
oldInput: String @deprecated
632+
otherInput: String @deprecated(reason: "Use newInput")
633+
newInput: String
634+
}
635+
630636
type Query {
631637
field1: String @deprecated
632638
field2: Int @deprecated(reason: "Because I said so")
633639
enum: MyEnum
634640
field3(oldArg: String @deprecated, arg: String): String
635641
field4(oldArg: String @deprecated(reason: "why not?"), arg: String): String
642+
field5(arg: MyInput): String
636643
}
637644
`;
638645
const output = cycleOutput(body);
@@ -668,6 +675,20 @@ describe('Schema Builder', () => {
668675
const field4OldArg = rootFields.field4.args[0];
669676
expect(field4OldArg.isDeprecated).to.equal(true);
670677
expect(field4OldArg.deprecationReason).to.equal('why not?');
678+
679+
const myInput = schema.getType('MyInput');
680+
const inputFields = myInput.getFields();
681+
682+
const newInput = inputFields.newInput;
683+
expect(newInput.isDeprecated).to.equal(false);
684+
685+
const oldInput = inputFields.oldInput;
686+
expect(oldInput.isDeprecated).to.equal(true);
687+
expect(oldInput.deprecationReason).to.equal('No longer supported');
688+
689+
const otherInput = inputFields.otherInput;
690+
expect(otherInput.isDeprecated).to.equal(true);
691+
expect(otherInput.deprecationReason).to.equal('Use newInput');
671692
});
672693

673694
it('Correctly assign AST nodes', () => {

0 commit comments

Comments
 (0)