MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / loadUpdaterModule

Function loadUpdaterModule

apps/desktop/main/update.test.ts:37–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37async function loadUpdaterModule() {
38 const autoUpdater = new FakeAutoUpdater()
39 const dialogCalls: DialogCall[] = []
40 const logMessages: string[] = []
41
42 await mock.module('electron', {
43 namedExports: {
44 app: {
45 isPackaged: true,
46 },
47 dialog: {
48 async showMessageBox(options: DialogCall) {
49 dialogCalls.push(options)
50 return { response: 1 }
51 },
52 },
53 },
54 })
55 await mock.module('electron-updater', {
56 namedExports: { autoUpdater },
57 })
58 await mock.module('@electron-toolkit/utils', {
59 namedExports: { platform: { isWindows: false } },
60 })
61 await mock.module('./logger', {
62 namedExports: {
63 logger: {
64 info(message: string) {
65 logMessages.push(message)
66 },
67 error(message: string) {
68 logMessages.push(message)
69 },
70 },
71 },
72 })
73 await mock.module('./network/proxy', {
74 namedExports: {
75 getActiveProxyUrl: () => undefined,
76 },
77 })
78 await mock.module('./worker/workerManager', {
79 namedExports: {
80 closeWorkerAsync: async () => undefined,
81 },
82 })
83 await mock.module('./i18n', {
84 namedExports: {
85 t: (key: string, params?: Record<string, string>) => `${key}${params?.version ? `:${params.version}` : ''}`,
86 },
87 })
88
89 const mod = await import('./update.js')
90 return {
91 autoUpdater,
92 dialogCalls,
93 checkUpdate: mod.checkUpdate as (win: { webContents: { send: (...args: unknown[]) => void } }) => void,
94 manualCheckForUpdates: mod.manualCheckForUpdates as () => void,

Callers 1

update.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected