Skip to content

Commit be5268e

Browse files
tests: remove a few invariants (#2383)
1 parent ec46d38 commit be5268e

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/execution/__tests__/nonnull-test.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import { expect } from 'chai';
44
import { describe, it } from 'mocha';
55

6-
import invariant from '../../jsutils/invariant';
7-
86
import { parse } from '../../language/parser';
97

108
import { GraphQLSchema } from '../../type/schema';
@@ -567,10 +565,7 @@ describe('Execute: handles non-nullable types', () => {
567565
type: GraphQLNonNull(GraphQLString),
568566
},
569567
},
570-
resolve: (_, args) => {
571-
invariant(typeof args.cannotBeNull === 'string');
572-
return 'Passed: ' + args.cannotBeNull;
573-
},
568+
resolve: (_, args) => 'Passed: ' + String(args.cannotBeNull),
574569
},
575570
},
576571
}),

src/subscription/__tests__/subscribe-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import EventEmitter from 'events';
88
import { expect } from 'chai';
99
import { describe, it } from 'mocha';
1010

11-
import invariant from '../../jsutils/invariant';
12-
1311
import { parse } from '../../language/parser';
1412

1513
import { GraphQLError } from '../../error/GraphQLError';
@@ -144,7 +142,7 @@ async function expectPromiseToThrow(promise, message) {
144142
/* istanbul ignore next */
145143
expect.fail('promise should have thrown but did not');
146144
} catch (error) {
147-
invariant(error instanceof Error);
145+
expect(error).to.be.an.instanceOf(Error);
148146
expect(error.message).to.equal(message);
149147
}
150148
}

0 commit comments

Comments
 (0)