Persist collector state and stabilize download controls
Persist collector packages and disclosure state through validated atomic AppData storage with backup recovery and shutdown synchronization. Align download sidebar metrics with the hidden-extracted presentation scope and keep Start available through temporary Real-Debrid cooldowns while preserving hard account blocks.
This commit is contained in:
@@ -7,7 +7,8 @@ const electron = vi.hoisted(() => ({
|
||||
invoke: vi.fn<(...args: unknown[]) => Promise<unknown>>(async () => undefined),
|
||||
getPathForFile: vi.fn(() => "C:\\Imports\\dropped.dlc"),
|
||||
on: vi.fn(),
|
||||
removeListener: vi.fn()
|
||||
removeListener: vi.fn(),
|
||||
sendSync: vi.fn((_: unknown, state: unknown) => state)
|
||||
}));
|
||||
|
||||
vi.mock("electron", () => ({
|
||||
@@ -20,6 +21,7 @@ vi.mock("electron", () => ({
|
||||
invoke: electron.invoke,
|
||||
on: electron.on,
|
||||
removeListener: electron.removeListener,
|
||||
sendSync: electron.sendSync,
|
||||
send: vi.fn()
|
||||
},
|
||||
webUtils: { getPathForFile: electron.getPathForFile }
|
||||
@@ -32,6 +34,7 @@ describe("account preload contract", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
electron.invoke.mockClear();
|
||||
electron.sendSync.mockClear();
|
||||
});
|
||||
|
||||
it("forwards submitted secrets only in write-only account commands", async () => {
|
||||
@@ -129,6 +132,20 @@ describe("account preload contract", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("loads and saves the persistent collector state through dedicated channels", async () => {
|
||||
const state = { packages: [], collapsedPackageIds: [] };
|
||||
|
||||
await electron.api?.getCollectorState();
|
||||
await electron.api?.saveCollectorState(state);
|
||||
electron.api?.saveCollectorStateSync(state);
|
||||
|
||||
expect(electron.invoke.mock.calls).toEqual([
|
||||
[IPC_CHANNELS.GET_COLLECTOR_STATE],
|
||||
[IPC_CHANNELS.SAVE_COLLECTOR_STATE, state]
|
||||
]);
|
||||
expect(electron.sendSync).toHaveBeenCalledWith(IPC_CHANNELS.SAVE_COLLECTOR_STATE_SYNC, state);
|
||||
});
|
||||
|
||||
it("resolves dropped files through Electron webUtils without IPC", () => {
|
||||
const file = { name: "dropped.dlc" } as File;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user