Skip to content

Commit 7dd6237

Browse files
committed
Add test for input arguments being deprecated
1 parent 4472230 commit 7dd6237

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
@@ -732,12 +732,19 @@ describe('Schema Builder', () => {
732732
OTHER_VALUE @deprecated(reason: "Terrible reasons")
733733
}
734734
735+
input MyInput {
736+
oldInput: String @deprecated
737+
otherInput: String @deprecated(reason: "Use newInput")
738+
newInput: String
739+
}
740+
735741
type Query {
736742
field1: String @deprecated
737743
field2: Int @deprecated(reason: "Because I said so")
738744
enum: MyEnum
739745
field3(oldArg: String @deprecated, arg: String): String
740746
field4(oldArg: String @deprecated(reason: "why not?"), arg: String): String
747+
field5(arg: MyInput): String
741748
}
742749
`;
743750
expect(cycleSDL(sdl)).to.equal(sdl);
@@ -802,6 +809,20 @@ describe('Schema Builder', () => {
802809
const field4OldArg = rootFields.field4.args[0];
803810
expect(field4OldArg.isDeprecated).to.equal(true);
804811
expect(field4OldArg.deprecationReason).to.equal('why not?');
812+
813+
const myInput = schema.getType('MyInput');
814+
const inputFields = myInput.getFields();
815+
816+
const newInput = inputFields.newInput;
817+
expect(newInput.isDeprecated).to.equal(false);
818+
819+
const oldInput = inputFields.oldInput;
820+
expect(oldInput.isDeprecated).to.equal(true);
821+
expect(oldInput.deprecationReason).to.equal('No longer supported');
822+
823+
const otherInput = inputFields.otherInput;
824+
expect(otherInput.isDeprecated).to.equal(true);
825+
expect(otherInput.deprecationReason).to.equal('Use newInput');
805826
});
806827

807828
it('Correctly extend object type', () => {

0 commit comments

Comments
 (0)