Skip to content

Commit

Permalink
test: πŸ’ make tests less flaky (#57991)
Browse files Browse the repository at this point in the history
βœ… Closes: #57823
  • Loading branch information
streamich authored Feb 19, 2020
1 parent c91e4a7 commit b7cc61f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plugins/expressions/common/execution/execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,18 @@ describe('Execution', () => {
});

test('execution state is "pending" while execution is in progress', async () => {
jest.useFakeTimers();
const execution = createExecution('sleep 20');
execution.start(null);
await new Promise(r => setTimeout(r, 5));
jest.advanceTimersByTime(5);
expect(execution.state.get().state).toBe('pending');
jest.useRealTimers();
});

test('execution state is "result" when execution successfully completes', async () => {
const execution = createExecution('sleep 1');
execution.start(null);
await new Promise(r => setTimeout(r, 30));
await execution.result;
expect(execution.state.get().state).toBe('result');
});

Expand Down

0 comments on commit b7cc61f

Please sign in to comment.