Skip to content

Commit

Permalink
Convert fixtures to be JS files (#2816)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Oct 4, 2020
1 parent 5d109ec commit 7e79bbe
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 41 deletions.
14 changes: 9 additions & 5 deletions .eslintrc.yml
Expand Up @@ -508,8 +508,6 @@ overrides:
# `@typescript-eslint/eslint-plugin` rule list based on `v4.3.x`
##########################################################################

no-undef: off # FIXME: temporary disabled due to https://github.com/typescript-eslint/typescript-eslint/issues/2462

# Supported Rules
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
'@typescript-eslint/adjacent-overload-signatures': error
Expand Down Expand Up @@ -657,18 +655,24 @@ overrides:
'@typescript-eslint/semi': off
'@typescript-eslint/space-before-function-paren': off
'@typescript-eslint/type-annotation-spacing': off
- files: ['src/**/__*__/**', 'integrationTests/**']
- files: 'src/**/__*__/**'
rules:
node/no-unpublished-import: off
import/no-restricted-paths: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off # TODO remove
no-restricted-syntax: off
- files: 'integrationTests/*'
rules:
node/no-unpublished-require: off
node/no-sync: off
import/no-restricted-paths: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
no-restricted-syntax: off
- files: 'integrationTests/*/**'
rules:
node/no-sync: off
node/no-missing-require: off
import/no-nodejs-modules: off
no-console: off
- files: 'benchmark/**'
rules:
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore
Expand Up @@ -6,6 +6,3 @@
/denoDist
/npm
/deno

# Don't touch GraphQL files.
/src/**/*.graphql
11 changes: 0 additions & 11 deletions src/__fixtures__/index.js

This file was deleted.

@@ -1,3 +1,5 @@
// $FlowFixMe[incompatible-call]
const kitchenSinkQuery: string = String.raw`
query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
whoever123is: node(id: [123, 456]) {
id
Expand Down Expand Up @@ -62,3 +64,6 @@ fragment frag on Friend @onFragmentDefinition {
query {
__typename
}
`;

export default kitchenSinkQuery;
@@ -1,3 +1,4 @@
const kitchenSinkSDL: string = `
"""This is a description of the schema as a whole."""
schema {
query: QueryType
Expand All @@ -6,21 +7,21 @@ schema {
"""
This is a description
of the `Foo` type.
of the \`Foo\` type.
"""
type Foo implements Bar & Baz & Two {
"Description of the `one` field."
"Description of the \`one\` field."
one: Type
"""
This is a description of the `two` field.
This is a description of the \`two\` field.
"""
two(
"""
This is a description of the `argument` argument.
This is a description of the \`argument\` argument.
"""
argument: InputType!
): Type
"""This is a description of the `three` field."""
"""This is a description of the \`three\` field."""
three(argument: InputType, other: String): Int
four(argument: String = "string"): String
five(argument: [String] = ["string", "string"]): String
Expand Down Expand Up @@ -86,14 +87,14 @@ extend scalar CustomScalar @onScalar
enum Site {
"""
This is a description of the `DESKTOP` value
This is a description of the \`DESKTOP\` value
"""
DESKTOP
"""This is a description of the `MOBILE` value"""
"""This is a description of the \`MOBILE\` value"""
MOBILE
"This is a description of the `WEB` value"
"This is a description of the \`WEB\` value"
WEB
}
Expand Down Expand Up @@ -128,10 +129,10 @@ extend input InputType {
extend input InputType @onInputObject
"""
This is a description of the `@skip` directive
This is a description of the \`@skip\` directive
"""
directive @skip(
"""This is a description of the `if` argument"""
"""This is a description of the \`if\` argument"""
if: Boolean! @onArgumentDefinition
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand All @@ -154,3 +155,6 @@ extend schema @onSchema
extend schema @onSchema {
subscription: SubscriptionType
}
`;

export default kitchenSinkSDL;
3 changes: 1 addition & 2 deletions src/language/__tests__/parser-test.js
Expand Up @@ -4,6 +4,7 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';

import dedent from '../../__testUtils__/dedent';
import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';

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

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

import { kitchenSinkQuery } from '../../__fixtures__/index';

import toJSONDeep from './toJSONDeep';

function expectSyntaxError(text: string) {
Expand Down
3 changes: 1 addition & 2 deletions src/language/__tests__/printer-test.js
Expand Up @@ -2,12 +2,11 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';

import dedent from '../../__testUtils__/dedent';
import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';

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

import { kitchenSinkQuery } from '../../__fixtures__/index';

describe('Printer: Query document', () => {
it('does not alter ast', () => {
const ast = parse(kitchenSinkQuery);
Expand Down
3 changes: 1 addition & 2 deletions src/language/__tests__/schema-parser-test.js
Expand Up @@ -2,8 +2,7 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';

import dedent from '../../__testUtils__/dedent';

import { kitchenSinkSDL } from '../../__fixtures__/index';
import kitchenSinkSDL from '../../__testUtils__/kitchenSinkSDL';

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

Expand Down
3 changes: 1 addition & 2 deletions src/language/__tests__/schema-printer-test.js
Expand Up @@ -2,12 +2,11 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';

import dedent from '../../__testUtils__/dedent';
import kitchenSinkSDL from '../../__testUtils__/kitchenSinkSDL';

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

import { kitchenSinkSDL } from '../../__fixtures__/index';

describe('Printer: SDL document', () => {
it('prints minimal ast', () => {
const ast = {
Expand Down
4 changes: 2 additions & 2 deletions src/language/__tests__/visitor-test.js
@@ -1,15 +1,15 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';

import invariant from '../../jsutils/invariant';

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

import { kitchenSinkQuery } from '../../__fixtures__/index';

function checkVisitorFnArgs(ast: any, args: any, isEdited: boolean = false) {
const [node, key, parent, path, ancestors] = args;

Expand Down
4 changes: 2 additions & 2 deletions src/utilities/__tests__/stripIgnoredCharacters-test.js
Expand Up @@ -3,6 +3,8 @@ import { describe, it } from 'mocha';

import dedent from '../../__testUtils__/dedent';
import inspectStr from '../../__testUtils__/inspectStr';
import kitchenSinkSDL from '../../__testUtils__/kitchenSinkSDL';
import kitchenSinkQuery from '../../__testUtils__/kitchenSinkQuery';

import invariant from '../../jsutils/invariant';

Expand All @@ -12,8 +14,6 @@ import { Source } from '../../language/source';

import { stripIgnoredCharacters } from '../stripIgnoredCharacters';

import { kitchenSinkQuery, kitchenSinkSDL } from '../../__fixtures__/index';

const ignoredTokens = [
// UnicodeBOM ::
'\uFEFF', // Byte Order Mark (U+FEFF)
Expand Down

0 comments on commit 7e79bbe

Please sign in to comment.