mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-12 04:12:30 +00:00
Align host settings with the 1.0 lifecycle
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import type { ObsidianLiveSyncSettings } from "@vrtmrz/livesync-commonlib/compat/common/types";
|
||||
import { createNewVaultSettings } from "@vrtmrz/livesync-commonlib/settings";
|
||||
|
||||
export function createEditingSettingsAfterFullReset<T extends ObsidianLiveSyncSettings>(editingSettings: T): T {
|
||||
return { ...editingSettings, ...createNewVaultSettings(), isConfigured: false };
|
||||
}
|
||||
|
||||
export function createCoreSettingsAfterFullReset(): ObsidianLiveSyncSettings {
|
||||
return { ...createNewVaultSettings(), isConfigured: false };
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { DEFAULT_SETTINGS, type ObsidianLiveSyncSettings } from "@vrtmrz/livesync-commonlib/compat/common/types";
|
||||
import { createNewVaultSettings } from "@vrtmrz/livesync-commonlib/settings";
|
||||
import { createCoreSettingsAfterFullReset, createEditingSettingsAfterFullReset } from "./settingsReset.ts";
|
||||
|
||||
describe("full settings reset", () => {
|
||||
it("resets the persisted settings to the recommended new-Vault values", () => {
|
||||
const settings = createCoreSettingsAfterFullReset();
|
||||
expect(settings).toEqual({
|
||||
...createNewVaultSettings(),
|
||||
isConfigured: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves settings-dialog fields while applying the new-Vault values", () => {
|
||||
const editing = {
|
||||
...DEFAULT_SETTINGS,
|
||||
configPassphrase: "dialog-only",
|
||||
} as ObsidianLiveSyncSettings & { configPassphrase: string };
|
||||
|
||||
expect(createEditingSettingsAfterFullReset(editing)).toEqual({
|
||||
...editing,
|
||||
...createNewVaultSettings(),
|
||||
isConfigured: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user