test(electron): add unit tests for updater (#5439)

This commit is contained in:
Joooye_34
2023-12-29 04:39:28 +00:00
parent 15566d8507
commit 5a1065c646
9 changed files with 314 additions and 0 deletions

View 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;
}
}