Skip to content

Commit

Permalink
Enable Flow on "subscribe-test.js" (#1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 18, 2019
1 parent 86f2464 commit 55bb0eb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/subscription/__tests__/subscribe-test.js
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @flow strict
*/

import { expect } from 'chai';
Expand Down Expand Up @@ -129,6 +129,7 @@ async function createSubscription(pubsub, schema = emailSchema, ast, vars) {
// `subscribe` returns Promise<AsyncIterator | ExecutionResult>
return {
sendImportantEmail,
// $FlowFixMe
subscription: await subscribe(schema, ast || defaultAST, data, null, vars),
};
}
Expand Down Expand Up @@ -163,6 +164,7 @@ describe('Subscription Initialization Phase', () => {
},
});

// $FlowFixMe
ai.return();
});

Expand Down Expand Up @@ -224,6 +226,7 @@ describe('Subscription Initialization Phase', () => {
importantEmail: {},
});

// $FlowFixMe
await subscription.next();
});

Expand Down Expand Up @@ -257,6 +260,7 @@ describe('Subscription Initialization Phase', () => {
importantEmail: {},
});

// $FlowFixMe
await subscription.next();
});

Expand Down Expand Up @@ -297,6 +301,7 @@ describe('Subscription Initialization Phase', () => {
`);

const subscription = await subscribe(testSchema, ast);
// $FlowFixMe
subscription.next(); // Ask for a result, but ignore it.

expect(didResolveImportantEmail).to.equal(true);
Expand All @@ -314,23 +319,27 @@ describe('Subscription Initialization Phase', () => {
`);

await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
() => subscribe(null, document),
'Expected null to be a GraphQL schema.',
);

await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
() => subscribe({ document }),
'Expected undefined to be a GraphQL schema.',
);
});

it('throws an error if document is missing', async () => {
await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
() => subscribe(emailSchema, null),
'Must provide document',
);

await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
() => subscribe({ schema: emailSchema }),
'Must provide document',
);
Expand Down Expand Up @@ -465,6 +474,7 @@ describe('Subscription Initialization Phase', () => {
},
};

// $FlowFixMe
const result = await subscribe(emailSchema, ast, data, null, {
priority: 'meow',
});
Expand Down Expand Up @@ -831,6 +841,7 @@ describe('Subscription Publish Phase', () => {
`),
);

// $FlowFixMe
const payload1 = await subscription.next();
expect(payload1).to.deep.equal({
done: false,
Expand Down Expand Up @@ -902,6 +913,7 @@ describe('Subscription Publish Phase', () => {
`),
);

// $FlowFixMe
const payload1 = await subscription.next();
expect(payload1).to.deep.equal({
done: false,
Expand Down

0 comments on commit 55bb0eb

Please sign in to comment.