Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c7ebf14

Browse files
committed
Fix tests for graphql v14.x, up min required version to GraphQL v14.6.0
1 parent 0d9c412 commit c7ebf14

File tree

5 files changed

+117
-132
lines changed

5 files changed

+117
-132
lines changed

‎.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ workflows:
1212
# definitions for field extensions in older @types/graphql versions
1313
matrix:
1414
parameters:
15-
graphql-version: ['~14.5', '~14.6', '~15.0']
15+
graphql-version: ['~14.6', '~14.7', '~15.0']
1616
- test-and-build:
1717
# Leave graphql-version unspecified to respect the lockfile and also run tsc
1818
name: test-and-build-with-typecheck

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"lodash.get": "^4.4.2"
2828
},
2929
"peerDependencies": {
30-
"graphql": "^14.5.0 || ^15.0.0"
30+
"graphql": "^14.6.0 || ^15.0.0"
3131
},
3232
"files": [
3333
"dist",
@@ -60,7 +60,7 @@
6060
"@typescript-eslint/parser": "^5.1.0",
6161
"chai": "^4.3.4",
6262
"eslint": "^8.0.1",
63-
"graphql": "^14.5.0 || ^15.0.0",
63+
"graphql": "14.6.0",
6464
"mocha": "^9.1.3",
6565
"prettier": "^2.4.1",
6666
"rimraf": "^3.0.2",

‎src/QueryComplexity.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ export default class QueryComplexity {
168168
// with default values defined in the operation
169169
this.variableValues = getVariableValues(
170170
this.context.getSchema(),
171-
operation.variableDefinitions ?? [],
171+
// We have to create a new array here because input argument is not readonly in graphql ~14.6.0
172+
operation.variableDefinitions ? [...operation.variableDefinitions] : [],
172173
this.options.variables ?? {}
173174
).coerced;
174175

‎src/estimators/directive/__tests__/directiveEstimator-test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
visit,
1212
visitWithTypeInfo,
1313
buildSchema,
14+
GraphQLString,
15+
GraphQLObjectType,
1416
} from 'graphql';
1517

1618
import { expect } from 'chai';
@@ -234,6 +236,14 @@ describe('directiveEstimator analysis', () => {
234236
const complexityDirective = createComplexityDirective();
235237
const codeFirstSchema = new GraphQLSchema({
236238
directives: [complexityDirective],
239+
query: new GraphQLObjectType({
240+
name: 'Query',
241+
fields: {
242+
dummy: {
243+
type: GraphQLString,
244+
},
245+
},
246+
}),
237247
});
238248

239249
// rebuilding code first schema
@@ -255,6 +265,14 @@ describe('directiveEstimator analysis', () => {
255265
const complexityDirective = createComplexityDirective({ name: 'cost' });
256266
const codeFirstSchema = new GraphQLSchema({
257267
directives: [complexityDirective],
268+
query: new GraphQLObjectType({
269+
name: 'Query',
270+
fields: {
271+
dummy: {
272+
type: GraphQLString,
273+
},
274+
},
275+
}),
258276
});
259277

260278
// rebuilding code first schema

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /