Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
fix(tests): use toConfig polyfill for all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Mar 9, 2020
1 parent ff6ac23 commit f19d865
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/test/testMapSchema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { expect } from 'chai';
import { GraphQLSchema, GraphQLObjectType, graphqlSync } from 'graphql';
import {
GraphQLFieldConfig,
GraphQLObjectType,
GraphQLSchema,
graphqlSync,
} from 'graphql';

import { makeExecutableSchema, mapSchema } from '../index';
import { MapperKind } from '../utils/map';
import { toConfig } from '../polyfills';

describe('mapSchema', () => {
it('does not throw', () => {
Expand All @@ -29,8 +35,10 @@ describe('mapSchema', () => {

const newSchema = mapSchema(schema, {
[MapperKind.QUERY]: type => {
const queryConfig = type.toConfig();
queryConfig.fields.version.resolve = () => 1;
const queryConfig = toConfig(type);
(queryConfig.fields as {
version: GraphQLFieldConfig<any, any>;
}).version.resolve = () => 1;
return new GraphQLObjectType(queryConfig);
},
});
Expand All @@ -52,7 +60,7 @@ describe('mapSchema', () => {

const newSchema = mapSchema(schema, {
[MapperKind.QUERY]: type => {
const queryConfig = type.toConfig();
const queryConfig = toConfig(type);
queryConfig.name = 'RootQuery';
return new GraphQLObjectType(queryConfig);
},
Expand Down

0 comments on commit f19d865

Please sign in to comment.