Skip to content

Commit

Permalink
add edge case for Enable Auto Save button
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Dec 13, 2024
1 parent c5ee4e7 commit ace4aef
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,18 @@ describe("Workspace Utils Unit Tests - function handleAutoSaveOnError", () => {
);
});

it("does nothing if 'Enable Auto Save' clicked and Auto Save is already on", async () => {
const blockMocks = getBlockMocks(true, "Enable Auto Save");
await workspaceUtils.handleAutoSaveOnError();
expect(blockMocks.executeCommand).toHaveBeenCalledWith("workbench.action.toggleAutoSave");
expect(blockMocks.executeCommand).toHaveBeenCalledTimes(1);
});

it("reactivates Auto Save if 'Enable Auto Save' clicked", async () => {
const blockMocks = getBlockMocks(true, "Enable Auto Save");
blockMocks.getDirectValue.mockReturnValueOnce("off");
await workspaceUtils.handleAutoSaveOnError();
expect(blockMocks.executeCommand).toHaveBeenCalledTimes(2);
expect(blockMocks.executeCommand).toHaveBeenCalledWith("workbench.action.toggleAutoSave");
});
});

0 comments on commit ace4aef

Please sign in to comment.