Skip to content

Commit df2a17f

Browse files
corydeppennodkz
authored andcommitted
test: add test case for issue 181
1 parent b5f7c56 commit df2a17f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* @flow */
2+
3+
import { schemaComposer, InputTypeComposer } from 'graphql-compose';
4+
import {
5+
processFilterOperators,
6+
OPERATORS_FIELDNAME,
7+
} from '../../resolvers/helpers/filterOperators';
8+
9+
let itc: InputTypeComposer<any>;
10+
11+
beforeEach(() => {
12+
schemaComposer.clear();
13+
itc = schemaComposer.createInputTC({
14+
name: 'UserFilterInput',
15+
fields: {
16+
_id: 'String',
17+
employment: 'String',
18+
name: 'String',
19+
age: 'Int',
20+
skills: ['String'],
21+
},
22+
});
23+
});
24+
25+
describe(`issue #181 - Cannot read property '_operators' of null`, () => {
26+
it('should call query.find if operator value is null', () => {
27+
const filter = {
28+
[OPERATORS_FIELDNAME]: { age: { ne: null } },
29+
};
30+
expect(processFilterOperators(filter)).toEqual({ age: { $ne: null } });
31+
});
32+
});

0 commit comments

Comments
 (0)