Skip to content

Commit

Permalink
fix: type check (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gumichocopengin8 committed Feb 25, 2020
1 parent 84d4821 commit 84cc41e
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ import { GraphQLSchema } from 'graphql/type';
import { parse } from 'graphql/language';
import { loadConfig } from 'graphql-config';
import fetchMock from 'fetch-mock';
import { introspectionFromSchema } from 'graphql';

import {
introspectionFromSchema,
FragmentDefinitionNode,
TypeDefinitionNode,
} from 'graphql';
import { GraphQLCache } from '../GraphQLCache';
import { getQueryAndRange } from '../MessageProcessor';
import { FragmentInfo, ObjectTypeInfo } from 'graphql-language-service-types';

function wihtoutASTNode(definition: any) {
const result = { ...definition };
Expand Down Expand Up @@ -119,17 +123,17 @@ describe('GraphQLCache', () => {

const catDefinition = parse(catContent).definitions[0];

const fragmentDefinitions = new Map();
const fragmentDefinitions = new Map<string, FragmentInfo>();
fragmentDefinitions.set('Duck', {
file: 'someFilePath',
content: duckContent,
definition: duckDefinition,
});
} as FragmentInfo);
fragmentDefinitions.set('Cat', {
file: 'someOtherFilePath',
content: catContent,
definition: catDefinition,
});
definition: catDefinition as FragmentDefinitionNode,
} as FragmentInfo);

it('finds fragments referenced in Relay queries', async () => {
const text =
Expand Down Expand Up @@ -197,7 +201,7 @@ describe('GraphQLCache', () => {
`;
const parsedQuery = parse(query);

const namedTypeDefinitions = new Map();
const namedTypeDefinitions = new Map<string, ObjectTypeInfo>();
namedTypeDefinitions.set('Character', {
file: 'someOtherFilePath',
content: query,
Expand All @@ -211,8 +215,8 @@ describe('GraphQLCache', () => {
start: 0,
end: 0,
},
},
});
} as TypeDefinitionNode,
} as ObjectTypeInfo);

it('finds named types referenced from the SDL', async () => {
const result = await cache.getObjectTypeDependenciesForAST(
Expand Down

0 comments on commit 84cc41e

Please sign in to comment.