mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 07:17:00 +08:00
test(electron): add unit tests for updater (#5439)
This commit is contained in:
34
packages/frontend/electron/test/main/mocks/app-adapter.ts
Normal file
34
packages/frontend/electron/test/main/mocks/app-adapter.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { AppAdapter } from 'electron-updater/out/AppAdapter';
|
||||
|
||||
/**
|
||||
* For testing and same as:
|
||||
* https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/ElectronAppAdapter.ts
|
||||
*/
|
||||
export class MockedAppAdapter implements AppAdapter {
|
||||
version: string;
|
||||
name = 'AFFiNE-testing';
|
||||
isPackaged = true;
|
||||
appUpdateConfigPath = '';
|
||||
userDataPath = '';
|
||||
baseCachePath = '';
|
||||
|
||||
constructor(version: string) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
whenReady() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
relaunch() {
|
||||
return;
|
||||
}
|
||||
|
||||
quit() {
|
||||
return;
|
||||
}
|
||||
|
||||
onQuit(_handler: (exitCode: number) => void) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user