|
1 | 1 | import { describe, expect, it, vi } from "vitest"; |
2 | 2 | import { |
3 | | - clearFlaggedAccountsEntry, |
4 | 3 | exportAccountsSnapshot, |
5 | 4 | importAccountsSnapshot, |
6 | | - saveFlaggedAccountsEntry, |
7 | 5 | } from "../lib/storage/account-port.js"; |
8 | 6 |
|
9 | 7 | describe("account port helpers", () => { |
10 | | - it("delegates flagged save through storage lock", async () => { |
11 | | - const saveUnlocked = vi.fn(async () => undefined); |
12 | | - await saveFlaggedAccountsEntry({ |
13 | | - storage: { version: 1, accounts: [] }, |
14 | | - withStorageLock: async (fn) => fn(), |
15 | | - saveUnlocked, |
16 | | - }); |
17 | | - expect(saveUnlocked).toHaveBeenCalled(); |
18 | | - }); |
19 | | - |
20 | | - it("delegates flagged clear through storage lock", async () => { |
21 | | - const clearFlaggedAccountsOnDisk = vi.fn(async () => undefined); |
22 | | - await clearFlaggedAccountsEntry({ |
23 | | - path: "/tmp/flagged.json", |
24 | | - withStorageLock: async (fn) => fn(), |
25 | | - markerPath: "/tmp/flagged.reset", |
26 | | - getBackupPaths: async () => ["/tmp/flagged.json.bak"], |
27 | | - clearFlaggedAccountsOnDisk, |
28 | | - logError: vi.fn(), |
29 | | - }); |
30 | | - expect(clearFlaggedAccountsOnDisk).toHaveBeenCalled(); |
31 | | - }); |
32 | | - |
33 | 8 | it("exports transaction snapshot when active", async () => { |
34 | 9 | const exportAccountsToFile = vi.fn(async () => undefined); |
35 | 10 | await exportAccountsSnapshot({ |
|
0 commit comments