mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
fix(specs): fix FeatureUsage spec
Summary: Damn async TaskQueue Test Plan: fixed Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3888
This commit is contained in:
parent
9c3dd29c10
commit
f33667e1a1
2 changed files with 11 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import pathwatcher from 'pathwatcher';
|
||||
import ReactTestUtils from 'react-addons-test-utils';
|
||||
import {TaskQueue} from 'nylas-exports'
|
||||
// TODO the local-sync package should be moved as part of nylas-mail core,
|
||||
// instead of being a separate package
|
||||
import {destroyTestDatabase} from '../../internal_packages/local-sync/spec/helpers'
|
||||
|
@ -29,6 +30,11 @@ class MasterAfterEach {
|
|||
NylasEnv.styles.restoreSnapshot(styleElementsToRestore);
|
||||
|
||||
this.removeAllSpies();
|
||||
if (TaskQueue._queue.length > 0) {
|
||||
console.inspect(TaskQueue._queue)
|
||||
TaskQueue._queue = []
|
||||
throw new Error("Your test forgot to clean up the TaskQueue")
|
||||
}
|
||||
waits(0);
|
||||
}); // yield to ui thread to make screen update more frequently
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {TaskQueueStatusStore} from 'nylas-exports'
|
||||
import {TaskQueue, TaskQueueStatusStore} from 'nylas-exports'
|
||||
import FeatureUsageStore from '../../src/flux/stores/feature-usage-store'
|
||||
import Task from '../../src/flux/tasks/task'
|
||||
import SendFeatureUsageEventTask from '../../src/flux/tasks/send-feature-usage-event-task'
|
||||
|
@ -53,6 +53,10 @@ describe("FeatureUsageStore", function featureUsageStoreSpec() {
|
|||
spyOn(TaskQueueStatusStore, "waitForPerformLocal").andReturn(Promise.resolve())
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TaskQueue._queue = []
|
||||
})
|
||||
|
||||
it("returns the num remaining if successful", async () => {
|
||||
let numLeft = await FeatureUsageStore.useFeature('is-usable');
|
||||
expect(numLeft).toBe(1)
|
||||
|
|
Loading…
Reference in a new issue