Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 4cfc0f0

Browse files
committed
usage-test: enable Flow check
1 parent 360bebf commit 4cfc0f0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.flowconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ unnecessary-invariant=error
4343
[options]
4444
include_warnings=true
4545
module.use_strict=true
46+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)?)\\)
47+
suppress_comment=\\(.\\|\n\\)*\\$DisableFlowOnNegativeTest
4648

4749
[version]
4850
^0.102.0

src/__tests__/usage-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @flow strict
2+
13
import { expect } from 'chai';
24
import { describe, it } from 'mocha';
35
import request from 'supertest';
@@ -8,13 +10,15 @@ import graphqlHTTP from '../';
810
describe('Useful errors when incorrectly used', () => {
911
it('requires an option factory function', () => {
1012
expect(() => {
13+
// $DisableFlowOnNegativeTest
1114
graphqlHTTP();
1215
}).to.throw('GraphQL middleware requires options.');
1316
});
1417

1518
it('requires option factory function to return object', async () => {
1619
const app = express();
1720

21+
// $DisableFlowOnNegativeTest
1822
app.use('/graphql', graphqlHTTP(() => null));
1923

2024
const response = await request(app).get('/graphql?query={test}');
@@ -33,6 +37,7 @@ describe('Useful errors when incorrectly used', () => {
3337
it('requires option factory function to return object or promise of object', async () => {
3438
const app = express();
3539

40+
// $DisableFlowOnNegativeTest
3641
app.use('/graphql', graphqlHTTP(() => Promise.resolve(null)));
3742

3843
const response = await request(app).get('/graphql?query={test}');
@@ -51,6 +56,7 @@ describe('Useful errors when incorrectly used', () => {
5156
it('requires option factory function to return object with schema', async () => {
5257
const app = express();
5358

59+
// $DisableFlowOnNegativeTest
5460
app.use('/graphql', graphqlHTTP(() => ({})));
5561

5662
const response = await request(app).get('/graphql?query={test}');
@@ -66,6 +72,7 @@ describe('Useful errors when incorrectly used', () => {
6672
it('requires option factory function to return object or promise of object with schema', async () => {
6773
const app = express();
6874

75+
// $DisableFlowOnNegativeTest
6976
app.use('/graphql', graphqlHTTP(() => Promise.resolve({})));
7077

7178
const response = await request(app).get('/graphql?query={test}');
@@ -79,6 +86,7 @@ describe('Useful errors when incorrectly used', () => {
7986
});
8087

8188
it('validates schema before executing request', async () => {
89+
// $DisableFlowOnNegativeTest
8290
const schema = new GraphQLSchema({ directives: [null] });
8391

8492
const app = express();

0 commit comments

Comments
 (0)