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

test: fix awaiting process.nextTick #1592

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
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: 3 additions & 3 deletions tests/renderer/components/editors-spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ describe('Editors component', () => {

emitEvent('select-all-in-editor');

await process.nextTick;
await new Promise(process.nextTick);
expect(editor.setSelection).toHaveBeenCalledWith('range');
});

Expand All @@ -185,7 +185,7 @@ describe('Editors component', () => {

emitEvent('select-all-in-editor');

await process.nextTick;
await new Promise(process.nextTick);
expect(editor.getModel).toHaveBeenCalledTimes(1);
expect(editor.setSelection).not.toHaveBeenCalled();
});
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('Editors component', () => {
editorMosaic.focusedEditor = jest.fn().mockReturnValue(editor);

emitEvent('select-all-in-editor');
await process.nextTick;
await new Promise(process.nextTick);

expect(editor.setSelection).toHaveBeenCalledWith(range);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('AppearanceSettings component', () => {
/>,
);

await process.nextTick;
await new Promise(process.nextTick);
expect((wrapper.state() as any).selectedTheme?.name).toBe('defaultDark');
});

Expand Down
4 changes: 2 additions & 2 deletions tests/renderer/runner-spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('Runner component', () => {
const result = await instance.run();

expect(result).toBe(RunResult.SUCCESS);
await process.nextTick;
await new Promise(process.nextTick);
expect(window.ElectronFiddle.cleanupDirectory).toHaveBeenCalledTimes(1);
expect(window.ElectronFiddle.deleteUserData).toHaveBeenCalledTimes(1);
expect(window.ElectronFiddle.deleteUserData).toHaveBeenCalledWith(
Expand All @@ -230,7 +230,7 @@ describe('Runner component', () => {
const result = await instance.run();

expect(result).toBe(RunResult.SUCCESS);
await process.nextTick;
await new Promise(process.nextTick);
expect(window.ElectronFiddle.cleanupDirectory).toHaveBeenCalledTimes(1);
});

Expand Down