import { ElectronAppAdapter } from "electron-updater/out/ElectronAppAdapter"
export class TestAppAdapter extends ElectronAppAdapter {
constructor(
version: string,
private _baseCachePath: string
) {
super(new MockApp(version) as any)
}
get baseCachePath(): string {
return this._baseCachePath
}
get userDataPath(): string {
return this._baseCachePath
}
get isPackaged(): boolean {
return true
}
whenReady(): Promise<void> {
return Promise.resolve()
}
quit(): void {
}
}
class MockApp {
constructor(private readonly version: string) {}
getVersion() {
return this.version
}
getName() {
return "test-updater-app"
}
getAppPath() {
return ""
}
getPath(type: string) {
throw new Error("must be not called")
}
on() {
}
once() {
}
isReady() {
return true
}
}