Skip to content

Commit

Permalink
Add test for input arguments being deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
smitt04 committed Oct 25, 2018
1 parent a22962e commit f84a7df
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/utilities/__tests__/buildASTSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,19 @@ describe('Schema Builder', () => {
OTHER_VALUE @deprecated(reason: "Terrible reasons")
}
input MyInput {
oldInput: String @deprecated
otherInput: String @deprecated(reason: "Use newInput")
newInput: String
}
type Query {
field1: String @deprecated
field2: Int @deprecated(reason: "Because I said so")
enum: MyEnum
field3(oldArg: String @deprecated, arg: String): String
field4(oldArg: String @deprecated(reason: "why not?"), arg: String): String
field5(arg: MyInput): String
}
`;
const output = cycleOutput(body);
Expand Down Expand Up @@ -668,6 +675,20 @@ describe('Schema Builder', () => {
const field4OldArg = rootFields.field4.args[0];
expect(field4OldArg.isDeprecated).to.equal(true);
expect(field4OldArg.deprecationReason).to.equal('why not?');

const myInput = schema.getType('MyInput');
const inputFields = myInput.getFields();

const newInput = inputFields.newInput;
expect(newInput.isDeprecated).to.equal(false);

const oldInput = inputFields.oldInput;
expect(oldInput.isDeprecated).to.equal(true);
expect(oldInput.deprecationReason).to.equal('No longer supported');

const otherInput = inputFields.otherInput;
expect(otherInput.isDeprecated).to.equal(true);
expect(otherInput.deprecationReason).to.equal('Use newInput');
});

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

0 comments on commit f84a7df

Please sign in to comment.