Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): report update install failure on the first click #24633

Closedjuliusmarmingewants to merge 3 commits intomain fromtakeover/pr-15386opened View on GitHub

Showing 2 changed files with 122 additions and 12 deletions.

x
0 of 2 viewed, 2 left
89 additions and 0 deletionsapps/desktop/src/electron/ElectronUpdater.test.tsAdded
View file
@@ -0,0 +1,89 @@
+import { assert, describe, it } from "@effect/vitest";
+import * as Effect from "effect/Effect";
+import * as Option from "effect/Option";
+import * as Result from "effect/Result";
+import * as NodeEvents from "node:events";
+import { beforeEach, vi } from "vite-plus/test";
+​
+const { autoUpdaterMock } = vi.hoisted(() => ({
+ autoUpdaterMock: {
+ channel: "latest",
+ events: undefined as unknown as NodeEvents.EventEmitter,
+ quitAndInstall: vi.fn(),
+ },
+}));
+​
+vi.mock("electron-updater", () => ({
+ autoUpdater: new Proxy(autoUpdaterMock, {
+ // electron-updater's autoUpdater is an EventEmitter; forward emitter methods.
+ get: (target, property) => {
+ if (property in target) return target[property as keyof typeof target];
+ const value = Reflect.get(target.events, property);
+ return typeof value === "function" ? value.bind(target.events) : value;
+ },
+ }),
+}));
+​
+import * as ElectronUpdater from "./ElectronUpdater.ts";
+​
+describe("ElectronUpdater.quitAndInstall", () => {
+ beforeEach(() => {