Skip to content

Commit

Permalink
test: fix awaiting process.nextTick (#1592)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed May 13, 2024
1 parent 406c61b commit b0ea491
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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

0 comments on commit b0ea491

Please sign in to comment.