mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-25 05:53:00 +00:00
test: recover review harness controller contract
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user