Skip to content

Commit 52d67fa

Browse files
smitt04modosc
authored andcommitted
Add test for input arguments being deprecated
1 parent 83c7325 commit 52d67fa

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);
@@ -804,6 +811,20 @@ describe('Schema Builder', () => {
804811
const field4OldArg = rootFields.field4.args[0];
805812
expect(field4OldArg.isDeprecated).to.equal(true);
806813
expect(field4OldArg.deprecationReason).to.equal('why not?');
814+
815+
const myInput = schema.getType('MyInput');
816+
const inputFields = myInput.getFields();
817+
818+
const newInput = inputFields.newInput;
819+
expect(newInput.isDeprecated).to.equal(false);
820+
821+
const oldInput = inputFields.oldInput;
822+
expect(oldInput.isDeprecated).to.equal(true);
823+
expect(oldInput.deprecationReason).to.equal('No longer supported');
824+
825+
const otherInput = inputFields.otherInput;
826+
expect(otherInput.isDeprecated).to.equal(true);
827+
expect(otherInput.deprecationReason).to.equal('Use newInput');
807828
});
808829

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

0 commit comments

Comments
 (0)