Skip to content

Commit 7ff44d0

Browse files
committed
style: Using reexported graphql via graphql-compose/lib/graphql
1 parent 39319da commit 7ff44d0

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

src/__mocks__/userTypeComposer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign */
33

4-
import { TypeComposer, Resolver, graphql } from 'graphql-compose';
5-
6-
const {
4+
import { TypeComposer, Resolver } from 'graphql-compose';
5+
import {
76
GraphQLString,
87
GraphQLObjectType,
98
GraphQLInputObjectType,
109
GraphQLEnumType,
1110
GraphQLInt,
12-
} = graphql;
11+
} from 'graphql-compose/lib/graphql';
1312

1413
export const UserType = new GraphQLObjectType({
1514
name: 'User',

src/__tests__/composeWithPagination-test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign */
33

4-
import { TypeComposer, graphql } from 'graphql-compose';
4+
import { TypeComposer } from 'graphql-compose';
5+
import { GraphQLSchema, GraphQLList, graphql } from 'graphql-compose/lib/graphql';
56
import { composeWithPagination } from '../composeWithPagination';
67
import { userTypeComposer } from '../__mocks__/userTypeComposer';
78
import { rootQueryTypeComposer as rootQueryTC } from '../__mocks__/rootQueryTypeComposer';
89

9-
const { GraphQLSchema, GraphQLList } = graphql;
10-
1110
describe('composeWithRelay', () => {
1211
const userComposer = composeWithPagination(userTypeComposer, {
1312
countResolverName: 'count',
@@ -100,7 +99,7 @@ describe('composeWithRelay', () => {
10099
gender
101100
}
102101
`;
103-
const result = await graphql.graphql(schema, query);
102+
const result = await graphql(schema, query);
104103
expect(result).toEqual({
105104
data: {
106105
userPagination: {
@@ -142,7 +141,7 @@ describe('composeWithRelay', () => {
142141
count
143142
}
144143
}`;
145-
await graphql.graphql(schema, query);
144+
await graphql(schema, query);
146145
// $FlowFixMe
147146
expect(Object.keys(topResolveParams.countResolveParams)).toEqual(
148147
expect.arrayContaining(['source', 'args', 'context', 'info', 'projection'])
@@ -172,7 +171,7 @@ describe('composeWithRelay', () => {
172171
count
173172
}
174173
}`;
175-
await graphql.graphql(schema, query);
174+
await graphql(schema, query);
176175
// $FlowFixMe
177176
expect(Object.keys(topResolveParams.findManyResolveParams)).toEqual(
178177
expect.arrayContaining(['source', 'args', 'context', 'info', 'projection'])

src/__tests__/paginationResolver-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/* @flow */
22
/* eslint-disable no-param-reassign */
33

4-
import { Resolver, graphql } from 'graphql-compose';
4+
import { Resolver } from 'graphql-compose';
5+
import { GraphQLInt } from 'graphql-compose/lib/graphql';
56
import { userTypeComposer } from '../__mocks__/userTypeComposer';
67
import { preparePaginationResolver } from '../paginationResolver';
78

8-
const { GraphQLInt } = graphql;
9-
109
describe('paginationResolver', () => {
1110
const spyFindManyResolve = jest.spyOn(userTypeComposer.getResolver('findMany'), 'resolve');
1211
const spyCountResolve = jest.spyOn(userTypeComposer.getResolver('count'), 'resolve');

src/types/__tests__/paginationType-test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
/* @flow */
22

3-
import { TypeComposer, graphql } from 'graphql-compose';
3+
import { TypeComposer } from 'graphql-compose';
4+
import {
5+
GraphQLNonNull,
6+
GraphQLObjectType,
7+
getNamedType,
8+
GraphQLInt,
9+
GraphQLList,
10+
} from 'graphql-compose/lib/graphql';
411
import { userTypeComposer } from '../../__mocks__/userTypeComposer';
512
import preparePaginationType from '../paginationType';
613
import PaginationInfoType from '../paginationInfoType';
714

8-
const { GraphQLNonNull, GraphQLObjectType, getNamedType, GraphQLInt, GraphQLList } = graphql;
9-
1015
describe('types/paginationType.js', () => {
1116
describe('preparePaginationType()', () => {
1217
it('should return GraphQLObjectType', () => {

src/types/paginationInfoType.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/* @flow */
22

3-
import { graphql } from 'graphql-compose';
4-
5-
const { GraphQLBoolean, GraphQLObjectType, GraphQLNonNull, GraphQLInt } = graphql;
3+
import {
4+
GraphQLBoolean,
5+
GraphQLObjectType,
6+
GraphQLNonNull,
7+
GraphQLInt,
8+
} from 'graphql-compose/lib/graphql';
69

710
const PaginationInfoType = new GraphQLObjectType({
811
name: 'PaginationInfo',

src/types/paginationType.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/* @flow */
22
/* eslint-disable arrow-body-style */
33

4-
import { graphql } from 'graphql-compose';
54
import type { TypeComposer } from 'graphql-compose';
5+
import {
6+
GraphQLInt,
7+
GraphQLObjectType,
8+
GraphQLNonNull,
9+
GraphQLList,
10+
} from 'graphql-compose/lib/graphql';
611
import PaginationInfoType from './paginationInfoType';
712

8-
const { GraphQLInt, GraphQLObjectType, GraphQLNonNull, GraphQLList } = graphql;
9-
1013
const cachedPaginationTypes = new WeakMap();
1114

1215
export default function preparePaginationType(typeComposer: TypeComposer): GraphQLObjectType {

0 commit comments

Comments
 (0)