Skip to content
Source
Sign inSign up
pingdotgg/t3code

Delete orphaned worktree when removing a thread #23

Mergedjuliusmarmingemerged 6 commits intomain fromcodething/b0e2dc22merged by juliusmarminge View on GitHub

Showing 10 changed files with 95 additions and 0 deletions (loading 7).

x
0 of 10 viewed, 10 left
57 additions and 0 deletionsapps/desktop/src/confirmDialog.test.tsAdded
View file
@@ -0,0 +1,57 @@
+import type { BrowserWindow } from "electron";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+​
+const { showMessageBoxMock } = vi.hoisted(() => ({
+ showMessageBoxMock: vi.fn(),
+}));
+​
+vi.mock("electron", () => ({
+ dialog: {
+ showMessageBox: showMessageBoxMock,
+ },
+}));
+​
+import { showDesktopConfirmDialog } from "./confirmDialog";
+​
+describe("showDesktopConfirmDialog", () => {
+ beforeEach(() => {
+ showMessageBoxMock.mockReset();
+ });
+​
+ it("returns false and does not open a dialog for empty messages", async () => {
+ const result = await showDesktopConfirmDialog(" ", null);
+​
+ expect(result).toBe(false);
+ expect(showMessageBoxMock).not.toHaveBeenCalled();
+ });
+​
+ it("opens a dialog for the focused window and returns true on confirm", async () => {
+ const ownerWindow = { id: 1 } as BrowserWindow;
+ showMessageBoxMock.mockResolvedValue({ response: 1 });