Skip to content

Commit

Permalink
test: Test sycning workspace cache on file remove
Browse files Browse the repository at this point in the history
  • Loading branch information
svsool committed Aug 6, 2020
1 parent 1e6eed2 commit 932373b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/features/fsWatcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,19 +256,21 @@ describe('fsWatcher feature', () => {
});
});

it.skip('should sync workspace cache on file remove (For some reason onDidDelete is not called timely in test env)', async () => {
it('should sync workspace cache on file remove', async () => {
const noteName = rndName();

await createFile(`${noteName}.md`);
await createFile(`${noteName}.md`, '', false);

const workspaceCache0 = await utils.getWorkspaceCache();

expect([...workspaceCache0.markdownUris, ...workspaceCache0.imageUris]).toHaveLength(1);
expect(
[...workspaceCache0.markdownUris, ...workspaceCache0.imageUris].map(({ fsPath }) =>
path.basename(fsPath),
),
).toContain(`${noteName}.md`);
await waitForExpect(async () => {
expect([...workspaceCache0.markdownUris, ...workspaceCache0.imageUris]).toHaveLength(1);
expect(
[...workspaceCache0.markdownUris, ...workspaceCache0.imageUris].map(({ fsPath }) =>
path.basename(fsPath),
),
).toContain(`${noteName}.md`);
});

removeFile(`${noteName}.md`);

Expand Down

0 comments on commit 932373b

Please sign in to comment.