Skip to content

Commit 8d4b0c5

Browse files
committed
feat(vscode-plugin): update file deletion test
1 parent 4009440 commit 8d4b0c5

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

packages/vscode-plugin/src/tests/suite/integration.test.ts

+19-3
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,35 @@ describe('Integration >', () => {
6464

6565
it('updates diagnostics when files are deleted', async () => {
6666
const markdownContent = await workspace.fs.readFile(markdownUri);
67-
// `harper-ls` can only be notified if the deletion happens within VSCode, so use these
68-
// commands instead of `workspace.fs.delete`.
67+
68+
// Delete file through VSCode
6969
await commands.executeCommand('workbench.files.action.showActiveFileInExplorer');
7070
await commands.executeCommand('deleteFile');
7171
// Wait for `harper-ls` to update diagnostics
72+
await sleep(450);
73+
74+
compareActualVsExpectedDiagnostics(
75+
getActualDiagnostics(markdownUri),
76+
createExpectedDiagnostics()
77+
);
78+
79+
// Restore and reopen deleted file
80+
await workspace.fs.writeFile(markdownUri, markdownContent);
81+
await openFile('integration.md');
82+
// Wait for `harper-ls` to update diagnostics
7283
await sleep(75);
7384

85+
// Delete file directly
86+
await workspace.fs.delete(markdownUri);
87+
// Wait for `harper-ls` to update diagnostics
88+
await sleep(450);
89+
7490
compareActualVsExpectedDiagnostics(
7591
getActualDiagnostics(markdownUri),
7692
createExpectedDiagnostics()
7793
);
7894

79-
// Re-create deleted file and open it again
95+
// Restore and reopen deleted file
8096
await workspace.fs.writeFile(markdownUri, markdownContent);
8197
await openFile('integration.md');
8298
});

0 commit comments

Comments
 (0)