Skip to content

Commit c79554e

Browse files
committed
test(mcp): a Store install gets no update notice
1 parent af42803 commit c79554e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎electron/cli/cliMain.test.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { runCli } from "./cliMain";
1212
const mocks = vi.hoisted(() => ({
1313
userData: "",
1414
isPackaged: false,
15+
channel: "nsis",
1516
serve: vi.fn(async (_options: { updateNotice?: string }) => undefined),
1617
netFetch: vi.fn(),
1718
}));
@@ -42,7 +43,7 @@ vi.mock("electron", () => ({
4243
systemPreferences: {},
4344
}));
4445
vi.mock("../install-channel", () => ({
45-
getInstallChannel: () => "nsis",
46+
getInstallChannel: () => mocks.channel,
4647
ownsItsUpdates: (channel: string) => channel === "nsis",
4748
}));
4849
vi.mock("../ipc/handlers", () => ({
@@ -63,6 +64,7 @@ let stdoutWrite: ReturnType<typeof vi.spyOn>;
6364
beforeEach(() => {
6465
mocks.userData = mkdtempSync(path.join(os.tmpdir(), "cli-usage-ping-"));
6566
mocks.isPackaged = false;
67+
mocks.channel = "nsis";
6668
mocks.serve.mockClear();
6769
mocks.netFetch.mockReset();
6870
fetchMock.mockClear();
@@ -148,4 +150,15 @@ describe("openscreen mcp update notice", () => {
148150
await runMcp();
149151
expect(mocks.serve.mock.calls[0][0].updateNotice).toBeUndefined();
150152
});
153+
154+
// The Store updates its copy: telling the user to open the app would offer a button that is not
155+
// there, and looking the release up would be wasted.
156+
it("says nothing, and looks nothing up, on a Store install", async () => {
157+
mocks.isPackaged = true;
158+
mocks.channel = "store";
159+
cacheLookup("9.9.9");
160+
await runMcp();
161+
expect(mocks.serve.mock.calls[0][0].updateNotice).toBeUndefined();
162+
expect(mocks.netFetch).not.toHaveBeenCalled();
163+
});
151164
});

0 commit comments

Comments
 (0)