Skip to content

Commit 7e79bbe

Browse files
Convert fixtures to be JS files (#2816)
1 parent 5d109ec commit 7e79bbe

File tree

11 files changed

+36
-41
lines changed

11 files changed

+36
-41
lines changed

.eslintrc.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,6 @@ overrides:
508508
# `@typescript-eslint/eslint-plugin` rule list based on `v4.3.x`
509509
##########################################################################
510510

511-
no-undef: off # FIXME: temporary disabled due to https://github.com/typescript-eslint/typescript-eslint/issues/2462
512-
513511
# Supported Rules
514512
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
515513
'@typescript-eslint/adjacent-overload-signatures': error
@@ -657,18 +655,24 @@ overrides:
657655
'@typescript-eslint/semi': off
658656
'@typescript-eslint/space-before-function-paren': off
659657
'@typescript-eslint/type-annotation-spacing': off
660-
- files: ['src/**/__*__/**', 'integrationTests/**']
658+
- files: 'src/**/__*__/**'
661659
rules:
662660
node/no-unpublished-import: off
661+
import/no-restricted-paths: off
662+
import/no-extraneous-dependencies: [error, { devDependencies: true }]
663+
import/no-nodejs-modules: off # TODO remove
664+
no-restricted-syntax: off
665+
- files: 'integrationTests/*'
666+
rules:
663667
node/no-unpublished-require: off
664668
node/no-sync: off
665-
import/no-restricted-paths: off
666669
import/no-extraneous-dependencies: [error, { devDependencies: true }]
667670
import/no-nodejs-modules: off
668-
no-restricted-syntax: off
669671
- files: 'integrationTests/*/**'
670672
rules:
673+
node/no-sync: off
671674
node/no-missing-require: off
675+
import/no-nodejs-modules: off
672676
no-console: off
673677
- files: 'benchmark/**'
674678
rules:

.prettierignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@
66
/denoDist
77
/npm
88
/deno
9-
10-
# Don't touch GraphQL files.
11-
/src/**/*.graphql

src/__fixtures__/index.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/__fixtures__/kitchen-sink.graphql renamed to src/__testUtils__/kitchenSinkQuery.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// $FlowFixMe[incompatible-call]
2+
const kitchenSinkQuery: string = String.raw`
13
query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
24
whoever123is: node(id: [123, 456]) {
35
id
@@ -62,3 +64,6 @@ fragment frag on Friend @onFragmentDefinition {
6264
query {
6365
__typename
6466
}
67+
`;
68+
69+
export default kitchenSinkQuery;

src/__fixtures__/schema-kitchen-sink.graphql renamed to src/__testUtils__/kitchenSinkSDL.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const kitchenSinkSDL: string = `
12
"""This is a description of the schema as a whole."""
23
schema {
34
query: QueryType
@@ -6,21 +7,21 @@ schema {
67
78
"""
89
This is a description
9-
of the `Foo` type.
10+
of the \`Foo\` type.
1011
"""
1112
type Foo implements Bar & Baz & Two {
12-
"Description of the `one` field."
13+
"Description of the \`one\` field."
1314
one: Type
1415
"""
15-
This is a description of the `two` field.
16+
This is a description of the \`two\` field.
1617
"""
1718
two(
1819
"""
19-
This is a description of the `argument` argument.
20+
This is a description of the \`argument\` argument.
2021
"""
2122
argument: InputType!
2223
): Type
23-
"""This is a description of the `three` field."""
24+
"""This is a description of the \`three\` field."""
2425
three(argument: InputType, other: String): Int
2526
four(argument: String = "string"): String
2627
five(argument: [String] = ["string", "string"]): String
@@ -86,14 +87,14 @@ extend scalar CustomScalar @onScalar
8687
8788
enum Site {
8889
"""
89-
This is a description of the `DESKTOP` value
90+
This is a description of the \`DESKTOP\` value
9091
"""
9192
DESKTOP
9293
93-
"""This is a description of the `MOBILE` value"""
94+
"""This is a description of the \`MOBILE\` value"""
9495
MOBILE
9596
96-
"This is a description of the `WEB` value"
97+
"This is a description of the \`WEB\` value"
9798
WEB
9899
}
99100
@@ -128,10 +129,10 @@ extend input InputType {
128129
extend input InputType @onInputObject
129130
130131
"""
131-
This is a description of the `@skip` directive
132+
This is a description of the \`@skip\` directive
132133
"""
133134
directive @skip(
134-
"""This is a description of the `if` argument"""
135+
"""This is a description of the \`if\` argument"""
135136
if: Boolean! @onArgumentDefinition
136137
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
137138
@@ -154,3 +155,6 @@ extend schema @onSchema
154155
extend schema @onSchema {
155156
subscription: SubscriptionType
156157
}
158+
`;
159+
160+
export default kitchenSinkSDL;

src/language/__tests__/parser-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { expect } from 'chai';
44
import { describe, it } from 'mocha';
55

66
import dedent from '../../__testUtils__/dedent';
7+
import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';
78

89
import inspect from '../../jsutils/inspect';
910

@@ -12,8 +13,6 @@ import { Source } from '../source';
1213
import { TokenKind } from '../tokenKind';
1314
import { parse, parseValue, parseType } from '../parser';
1415

15-
import { kitchenSinkQuery } from '../../__fixtures__/index';
16-
1716
import toJSONDeep from './toJSONDeep';
1817

1918
function expectSyntaxError(text: string) {

src/language/__tests__/printer-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { expect } from 'chai';
22
import { describe, it } from 'mocha';
33

44
import dedent from '../../__testUtils__/dedent';
5+
import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';
56

67
import { parse } from '../parser';
78
import { print } from '../printer';
89

9-
import { kitchenSinkQuery } from '../../__fixtures__/index';
10-
1110
describe('Printer: Query document', () => {
1211
it('does not alter ast', () => {
1312
const ast = parse(kitchenSinkQuery);

src/language/__tests__/schema-parser-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { expect } from 'chai';
22
import { describe, it } from 'mocha';
33

44
import dedent from '../../__testUtils__/dedent';
5-
6-
import { kitchenSinkSDL } from '../../__fixtures__/index';
5+
import kitchenSinkSDL from '../../__testUtils__/kitchenSinkSDL';
76

87
import { parse } from '../parser';
98

src/language/__tests__/schema-printer-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { expect } from 'chai';
22
import { describe, it } from 'mocha';
33

44
import dedent from '../../__testUtils__/dedent';
5+
import kitchenSinkSDL from '../../__testUtils__/kitchenSinkSDL';
56

67
import { parse } from '../parser';
78
import { print } from '../printer';
89

9-
import { kitchenSinkSDL } from '../../__fixtures__/index';
10-
1110
describe('Printer: SDL document', () => {
1211
it('prints minimal ast', () => {
1312
const ast = {

src/language/__tests__/visitor-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { expect } from 'chai';
22
import { describe, it } from 'mocha';
33

4+
import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';
5+
46
import invariant from '../../jsutils/invariant';
57

68
import type { ASTNode } from '../ast';
79
import { Kind } from '../kinds';
810
import { parse } from '../parser';
911
import { visit, visitInParallel, BREAK, QueryDocumentKeys } from '../visitor';
1012

11-
import { kitchenSinkQuery } from '../../__fixtures__/index';
12-
1313
function checkVisitorFnArgs(ast: any, args: any, isEdited: boolean = false) {
1414
const [node, key, parent, path, ancestors] = args;
1515

0 commit comments

Comments
 (0)