Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

test(editor): make the detach-tab save-failure document dirty (#924)

arookieofc416b65d65e7e
diff --git a/src/editor/core/detachTab.test.ts b/src/editor/core/detachTab.test.ts
index e919c6dd0..7786c23db 100644
--- a/src/editor/core/detachTab.test.ts
+++ b/src/editor/core/detachTab.test.ts
@@ -82,6 +82,9 @@ describe("detachTab", () => {
ctrl.start();
await ctrl.openFile(path, { focus: false });
const [pane, id] = current();
+ // Clean documents skip saving entirely, so the document must be dirty for
+ // the mocked save failure to be reached.
+ ctrl.slotFor(id)!.dispatchLocal({ changes: { from: 0, to: 8, insert: "edited" } });
vi.spyOn(backend, "save").mockRejectedValue(new Error("save failed"));
expect(await ctrl.detachTab(pane, id)).toBe(false);
expect(hasTab(id)).toBe(true);