forked from apollographql/graphql-tag
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding compatibility check for all supported versions of
graphql
(a…
…pollographql#156) * Adding compatibility testing for all `graphql` versions * Running `tav` only in CI and latest otherwise * Bumping to capture more versions of `graphql` * Only check compatibility * Try running `yarn test` instead * Run `tav` _after_ testing latest
- Loading branch information
Showing
8 changed files
with
635 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
graphql-0.11: | ||
name: graphql | ||
versions: "^0.9.0 || ^0.10.0 || ^0.11.0" | ||
commands: mocha test/graphql.js test/graphql-v0.11.js | ||
|
||
graphql-0.12: | ||
name: graphql | ||
versions: "^0.12.0 || ^0.13.0" | ||
commands: mocha test/graphql.js test/graphql-v0.12.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ node_js: | |
- "6" | ||
- "5" | ||
- "4" | ||
script: | ||
- yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
const gqlRequire = require("../src"); | ||
const gqlDefault = require("../src").default; | ||
const assert = require("chai").assert; | ||
|
||
[gqlRequire, gqlDefault].forEach((gql, i) => { | ||
describe(`gql ${i}`, () => { | ||
it("is correct for a simple query", () => { | ||
const ast = gql` | ||
{ | ||
user(id: 5) { | ||
firstName | ||
lastName | ||
} | ||
} | ||
`; | ||
|
||
assert.equal(ast.kind, "Document"); | ||
assert.deepEqual(ast.definitions, [ | ||
{ | ||
kind: "OperationDefinition", | ||
operation: "query", | ||
name: null, | ||
variableDefinitions: null, | ||
directives: [], | ||
selectionSet: { | ||
kind: "SelectionSet", | ||
selections: [ | ||
{ | ||
kind: "Field", | ||
alias: null, | ||
name: { | ||
kind: "Name", | ||
value: "user" | ||
}, | ||
arguments: [ | ||
{ | ||
kind: "Argument", | ||
name: { | ||
kind: "Name", | ||
value: "id" | ||
}, | ||
value: { | ||
kind: "IntValue", | ||
value: "5" | ||
} | ||
} | ||
], | ||
directives: [], | ||
selectionSet: { | ||
kind: "SelectionSet", | ||
selections: [ | ||
{ | ||
kind: "Field", | ||
alias: null, | ||
name: { | ||
kind: "Name", | ||
value: "firstName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: null | ||
}, | ||
{ | ||
kind: "Field", | ||
alias: null, | ||
name: { | ||
kind: "Name", | ||
value: "lastName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: null | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
]); | ||
}); | ||
it("is correct for a fragment", () => { | ||
const ast = gql` | ||
fragment UserFragment on User { | ||
firstName | ||
lastName | ||
} | ||
`; | ||
|
||
assert.equal(ast.kind, "Document"); | ||
assert.deepEqual(ast.definitions, [ | ||
{ | ||
kind: "FragmentDefinition", | ||
name: { | ||
kind: "Name", | ||
value: "UserFragment" | ||
}, | ||
typeCondition: { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: "User" | ||
} | ||
}, | ||
directives: [], | ||
selectionSet: { | ||
kind: "SelectionSet", | ||
selections: [ | ||
{ | ||
kind: "Field", | ||
alias: null, | ||
name: { | ||
kind: "Name", | ||
value: "firstName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: null | ||
}, | ||
{ | ||
kind: "Field", | ||
alias: null, | ||
name: { | ||
kind: "Name", | ||
value: "lastName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: null | ||
} | ||
] | ||
} | ||
} | ||
]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
const gqlRequire = require("../src"); | ||
const gqlDefault = require("../src").default; | ||
const assert = require("chai").assert; | ||
|
||
[gqlRequire, gqlDefault].forEach((gql, i) => { | ||
describe(`gql ${i}`, () => { | ||
it("is correct for a simple query", () => { | ||
const ast = gql` | ||
{ | ||
user(id: 5) { | ||
firstName | ||
lastName | ||
} | ||
} | ||
`; | ||
|
||
assert.equal(ast.kind, "Document"); | ||
assert.deepEqual(ast.definitions, [ | ||
{ | ||
kind: "OperationDefinition", | ||
operation: "query", | ||
name: undefined, | ||
variableDefinitions: [], | ||
directives: [], | ||
selectionSet: { | ||
kind: "SelectionSet", | ||
selections: [ | ||
{ | ||
kind: "Field", | ||
alias: undefined, | ||
name: { | ||
kind: "Name", | ||
value: "user" | ||
}, | ||
arguments: [ | ||
{ | ||
kind: "Argument", | ||
name: { | ||
kind: "Name", | ||
value: "id" | ||
}, | ||
value: { | ||
kind: "IntValue", | ||
value: "5" | ||
} | ||
} | ||
], | ||
directives: [], | ||
selectionSet: { | ||
kind: "SelectionSet", | ||
selections: [ | ||
{ | ||
kind: "Field", | ||
alias: undefined, | ||
name: { | ||
kind: "Name", | ||
value: "firstName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: undefined | ||
}, | ||
{ | ||
kind: "Field", | ||
alias: undefined, | ||
name: { | ||
kind: "Name", | ||
value: "lastName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: undefined | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
]); | ||
}); | ||
|
||
it("is correct for a fragment", () => { | ||
const ast = gql` | ||
fragment UserFragment on User { | ||
firstName | ||
lastName | ||
} | ||
`; | ||
|
||
assert.equal(ast.kind, "Document"); | ||
assert.deepEqual(ast.definitions, [ | ||
{ | ||
kind: "FragmentDefinition", | ||
name: { | ||
kind: "Name", | ||
value: "UserFragment" | ||
}, | ||
typeCondition: { | ||
kind: "NamedType", | ||
name: { | ||
kind: "Name", | ||
value: "User" | ||
} | ||
}, | ||
directives: [], | ||
selectionSet: { | ||
kind: "SelectionSet", | ||
selections: [ | ||
{ | ||
kind: "Field", | ||
alias: undefined, | ||
name: { | ||
kind: "Name", | ||
value: "firstName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: undefined | ||
}, | ||
{ | ||
kind: "Field", | ||
alias: undefined, | ||
name: { | ||
kind: "Name", | ||
value: "lastName" | ||
}, | ||
arguments: [], | ||
directives: [], | ||
selectionSet: undefined | ||
} | ||
] | ||
} | ||
} | ||
]); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.