Skip to content
Permalink
Browse files

Enable Flow on "subscribe-test.js" (#1865)

  • Loading branch information...
IvanGoncharov committed May 18, 2019
1 parent 86f2464 commit 55bb0ebe811929ed8227f09fc813ffb196e35ddb
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/subscription/__tests__/subscribe-test.js
@@ -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';
@@ -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),
};
}
@@ -163,6 +164,7 @@ describe('Subscription Initialization Phase', () => {
},
});

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

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

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

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

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

@@ -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);
@@ -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',
);
@@ -465,6 +474,7 @@ describe('Subscription Initialization Phase', () => {
},
};

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

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

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

0 comments on commit 55bb0eb

Please sign in to comment.
You can’t perform that action at this time.