Auto commit
All checks were successful
Build Org Website / build (push) Successful in 40s

This commit is contained in:
gitea-actions
2026-08-20 14:03:52 +01:00
parent 0b4a68b81b
commit 7a60d33610
11 changed files with 504 additions and 72 deletions

View File

@@ -43,6 +43,23 @@ test("merge replaces matching ids and keeps unrelated records", () => {
assert.ok(merged.vaults[0].resources.some((item) => item.id === "resource-2"));
});
test("server sync keeps newer fields and sessions from both devices", () => {
const remote = library([resource({
title: "Remote title",
updatedAt: "2026-01-02T00:00:00.000Z",
sessions: [{ id: "remote-session", end: 20, createdAt: "2026-01-02T00:00:00.000Z" }],
})]);
const local = library([resource({
title: "Newer local title",
updatedAt: "2026-01-03T00:00:00.000Z",
sessions: [{ id: "local-session", end: 30, createdAt: "2026-01-03T00:00:00.000Z" }],
})]);
const merged = Model.mergeForSync(remote, local);
const synced = merged.vaults[0].resources[0];
assert.equal(synced.title, "Newer local title");
assert.deepEqual(synced.sessions.map((session) => session.id).sort(), ["local-session", "remote-session"]);
});
test("vault and folder operations preserve records safely", () => {
let data = Model.addVault(library(), "Second", "#abcdef");
assert.equal(data.vaults.length, 2);