test: recover review harness controller contract

This commit is contained in:
vorotamoroz
2026-07-20 10:14:01 +00:00
parent 0a31d30c6c
commit 71f1b63b9a
6 changed files with 1098 additions and 1 deletions
+11 -1
View File
@@ -27,6 +27,7 @@ export interface CompatibilityReviewUi {
export class CompatibilityReviewController {
private pause: CompatibilityPause | undefined;
private activeReview: Promise<void> | undefined;
private _initialised = false;
private disposed = false;
constructor(
@@ -39,6 +40,10 @@ export class CompatibilityReviewController {
return this.pause;
}
get initialised(): boolean {
return this._initialised;
}
private readAcknowledgedVersion(): string | null {
const setting = this.core.services.setting;
const currentMarker = setting.getSmallConfig(DATABASE_COMPATIBILITY_VERSION_KEY);
@@ -68,14 +73,19 @@ export class CompatibilityReviewController {
this.pause = evaluation.pause;
if (evaluation.initialiseAcknowledgedVersion) {
setting.setSmallConfig(DATABASE_COMPATIBILITY_VERSION_KEY, `${this.currentVersion}`);
this._initialised = true;
return true;
}
if (!this.pause) {
this._initialised = true;
return true;
}
if (!this.pause) return true;
if (settings.versionUpFlash === "") {
settings.versionUpFlash = COMPATIBILITY_PAUSE_SETTING_MESSAGE;
await setting.saveSettingData();
}
this._initialised = true;
return true;
}
@@ -76,8 +76,11 @@ describe("compatibility review controller", () => {
it("initialises the acknowledged version for a new Vault without showing a pause", async () => {
const fixture = createFixture({ marker: null, migration: { isNewVault: true } });
expect(fixture.controller.initialised).toBe(false);
await expect(fixture.controller.initialise()).resolves.toBe(true);
expect(fixture.controller.initialised).toBe(true);
expect(fixture.local.get(DATABASE_COMPATIBILITY_VERSION_KEY)).toBe("12");
expect(fixture.controller.pendingPause).toBeUndefined();
expect(fixture.saveSettingData).not.toHaveBeenCalled();