Skip to content

Commit feba093

Browse files
committed
test: small fixes
1 parent 600c288 commit feba093

File tree

4 files changed

+1153
-662
lines changed

4 files changed

+1153
-662
lines changed

src/__tests__/ElasticApiParser-test.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// import fs from 'fs';
44
import dox from 'dox';
55
import path from 'path';
6-
import { GraphQLJSON, TypeComposer } from 'graphql-compose';
6+
import { GraphQLJSON, TypeComposer, EnumTypeComposer } from 'graphql-compose';
77
import {
88
GraphQLString,
99
GraphQLFloat,
@@ -303,14 +303,18 @@ describe('ElasticApiParser', () => {
303303
it('should convert to GraphQLEnumType', () => {
304304
const type = parser.getEnumType('f1', ['AND', 'OR']);
305305
expect(type).toBeInstanceOf(GraphQLEnumType);
306-
expect(type._values[0]).toMatchObject({ name: 'AND', value: 'AND' });
307-
expect(type._values[1]).toMatchObject({ name: 'OR', value: 'OR' });
306+
307+
const etc = EnumTypeComposer.create(type);
308+
expect(etc.getField('AND')).toMatchObject({ name: 'AND', value: 'AND' });
309+
expect(etc.getField('OR')).toMatchObject({ name: 'OR', value: 'OR' });
308310
});
309311

310312
it("should convert '' to empty_string", () => {
311313
const type = parser.getEnumType('f1', ['']);
312314
expect(type).toBeInstanceOf(GraphQLEnumType);
313-
expect(type._values[0]).toMatchObject({
315+
316+
const etc = EnumTypeComposer.create(type);
317+
expect(etc.getField('empty_string')).toMatchObject({
314318
name: 'empty_string',
315319
value: '',
316320
});
@@ -322,19 +326,21 @@ describe('ElasticApiParser', () => {
322326
// But we allow to use this values, just renaming it.
323327
const type = parser.getEnumType('f1', ['true', true, 'false', false]);
324328
expect(type).toBeInstanceOf(GraphQLEnumType);
325-
expect(type._values[0]).toMatchObject({
329+
330+
const etc = EnumTypeComposer.create(type);
331+
expect(etc.getField('true_string')).toMatchObject({
326332
name: 'true_string',
327333
value: 'true',
328334
});
329-
expect(type._values[1]).toMatchObject({
335+
expect(etc.getField('true_boolean')).toMatchObject({
330336
name: 'true_boolean',
331337
value: true,
332338
});
333-
expect(type._values[2]).toMatchObject({
339+
expect(etc.getField('false_string')).toMatchObject({
334340
name: 'false_string',
335341
value: 'false',
336342
});
337-
expect(type._values[3]).toMatchObject({
343+
expect(etc.getField('false_boolean')).toMatchObject({
338344
name: 'false_boolean',
339345
value: false,
340346
});
@@ -343,7 +349,9 @@ describe('ElasticApiParser', () => {
343349
it('should convert 1 to number_1', () => {
344350
const type = parser.getEnumType('f1', [1]);
345351
expect(type).toBeInstanceOf(GraphQLEnumType);
346-
expect(type._values[0]).toMatchObject({ name: 'number_1', value: 1 });
352+
353+
const etc = EnumTypeComposer.create(type);
354+
expect(etc.getField('number_1')).toMatchObject({ name: 'number_1', value: 1 });
347355
});
348356

349357
it('should provide name started with ElasticEnum', () => {

src/__tests__/typeStorage-test.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)