Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] test: 💍 make tests less flaky (#57991) #58013

Merged
merged 1 commit into from
Feb 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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