Skip to content

Commit

Permalink
test: Add waitForExpect on opening random notes in openRandomNote.spe…
Browse files Browse the repository at this point in the history
…c.ts
  • Loading branch information
svsool committed Aug 6, 2020
1 parent fa1f130 commit 3e9e74c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/commands/openRandomNote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
rndName,
getOpenedFilenames,
closeEditorsAndCleanWorkspace,
waitForExpect,
} from '../test/testUtils';

describe('openRandomNote command', () => {
Expand All @@ -31,7 +32,9 @@ describe('openRandomNote command', () => {
await commands.executeCommand('memo.openRandomNote');
await commands.executeCommand('memo.openRandomNote');

expect(getOpenedFilenames()).toEqual(expect.arrayContaining(filenames));
await waitForExpect(() => {
expect(getOpenedFilenames()).toEqual(expect.arrayContaining(filenames));
});
});

it('should open existing note only once on executing command multiple times', async () => {
Expand Down

0 comments on commit 3e9e74c

Please sign in to comment.