Skip to content

Commit cab5393

Browse files
committed
test: fix tsc errors
1 parent 66ebdf5 commit cab5393

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

src/resolvers/__tests__/createOne-test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable no-param-reassign */
22

33
import { Resolver, schemaComposer, ObjectTypeComposer } from 'graphql-compose';
4-
import { GraphQLNonNull } from 'graphql-compose/lib/graphql';
54
import { UserModel } from '../../__mocks__/userModel';
65
import createOne from '../createOne';
76
import { convertModelToGraphQL } from '../../fieldsConverter';

src/resolvers/__tests__/removeMany-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Query } from 'mongoose';
22
import { Resolver, schemaComposer, ObjectTypeComposer } from 'graphql-compose';
3-
import { GraphQLInt, GraphQLNonNull } from 'graphql-compose/lib/graphql';
3+
import { GraphQLInt } from 'graphql-compose/lib/graphql';
44
import { UserModel, IUser } from '../../__mocks__/userModel';
55
import removeMany from '../removeMany';
66
import { convertModelToGraphQL } from '../../fieldsConverter';

src/resolvers/helpers/__tests__/filterOperators-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Resolver helper `filter` ->', () => {
6565
it('should add OPERATORS_FIELDNAME via _createOperatorsField()', () => {
6666
addFilterOperators(itc, UserModel, {});
6767
expect(itc.hasField(OPERATORS_FIELDNAME)).toBe(true);
68-
expect(itc.getFieldTC(OPERATORS_FIELDNAME).getTypeName()).toBe('Operators');
68+
expect(itc.getFieldTC(OPERATORS_FIELDNAME).getTypeName()).toBe('OperatorsUserFilterInput');
6969
});
7070

7171
it('should add OR field', () => {

src/resolvers/helpers/filterOperators.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@ export function addFilterOperators(
2222
itc: InputTypeComposer<any>,
2323
model: Model<any>,
2424
opts: FilterHelperArgsOpts
25-
) {
25+
): void {
2626
if (!{}.hasOwnProperty.call(opts, 'operators') || opts.operators !== false) {
27-
_createOperatorsField(
28-
itc,
29-
`Operators${opts.filterTypeName || ''}`,
30-
model,
31-
opts.operators || {}
32-
);
27+
_createOperatorsField(itc, `Operators${itc.getTypeName() || ''}`, model, opts.operators || {});
3328
}
3429

3530
itc.addFields({
@@ -38,7 +33,7 @@ export function addFilterOperators(
3833
});
3934
}
4035

41-
export function processFilterOperators(filter: Record<string, any>) {
36+
export function processFilterOperators(filter: Record<string, any>): Record<string, any> {
4237
if (!filter) return filter;
4338
_prepareAndOrFilter(filter);
4439
if (filter[OPERATORS_FIELDNAME]) {
@@ -66,7 +61,7 @@ export function processFilterOperators(filter: Record<string, any>) {
6661
return filter;
6762
}
6863

69-
export function _prepareAndOrFilter(filter: Record<'OR' | 'AND' | '$or' | '$and', any>) {
64+
export function _prepareAndOrFilter(filter: Record<'OR' | 'AND' | '$or' | '$and', any>): void {
7065
/* eslint-disable no-param-reassign */
7166
if (!filter.OR && !filter.AND) return;
7267

0 commit comments

Comments
 (0)