mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-08-30 15:27:06 +00:00
Align host settings with the 1.0 lifecycle
This commit is contained in:
@@ -1,6 +1,33 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { CompatibilityPause } from "@/common/databaseCompatibility.ts";
|
||||
import { compatibilityReviewDetailsMarkdown } from "./compatibilityReviewMarkdown.ts";
|
||||
import { ObsidianCompatibilityReviewUi } from "./compatibilityReviewObsidian.ts";
|
||||
|
||||
vi.mock("@/deps.ts", () => ({
|
||||
Notice: class {
|
||||
hide() {}
|
||||
},
|
||||
}));
|
||||
|
||||
const unresolvedFilenameCasePause: CompatibilityPause = {
|
||||
resumable: true,
|
||||
reasons: [
|
||||
{
|
||||
source: "settings-schema",
|
||||
sourceVersion: 10,
|
||||
currentVersion: 10,
|
||||
isFromFutureSchema: false,
|
||||
resumable: true,
|
||||
reviewReasons: [
|
||||
{
|
||||
code: "filename-case-sensitivity-unresolved",
|
||||
fromVersion: 10,
|
||||
toVersion: 10,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe("Obsidian compatibility review", () => {
|
||||
it("explains why a configured Vault can be missing its device-local acknowledgement", async () => {
|
||||
@@ -21,4 +48,27 @@ describe("Obsidian compatibility review", () => {
|
||||
expect(details).toContain("new Obsidian profile");
|
||||
expect(details).toContain("does not mean that it is safe to resume automatically");
|
||||
});
|
||||
|
||||
it("explains the safe choices for an unresolved filename-case policy", () => {
|
||||
const details = compatibilityReviewDetailsMarkdown(unresolvedFilenameCasePause);
|
||||
expect(details).toContain("file-name case policy");
|
||||
expect(details).toContain("case-sensitive handling preserves the earlier behaviour");
|
||||
expect(details).toContain("case-insensitive handling requires a database rebuild");
|
||||
});
|
||||
|
||||
it("offers the legacy-compatible case decision instead of a generic resume action", async () => {
|
||||
const label = "Keep case-sensitive handling and resume";
|
||||
const confirmWithMessage = vi.fn().mockResolvedValue(label);
|
||||
const ui = new ObsidianCompatibilityReviewUi({ confirmWithMessage } as never);
|
||||
|
||||
await expect(ui.showSummary(unresolvedFilenameCasePause)).resolves.toBe("use-case-sensitive");
|
||||
expect(confirmWithMessage).toHaveBeenCalledWith(
|
||||
"Synchronisation paused for compatibility review",
|
||||
expect.any(String),
|
||||
["Review compatibility details", label, "Keep synchronisation paused"],
|
||||
"Keep synchronisation paused",
|
||||
undefined,
|
||||
"vertical"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user