addition of new dashboard

This commit is contained in:
2026-08-20 15:08:32 +00:00
parent 0622018d95
commit bf59249ed7
161 changed files with 13170 additions and 119 deletions

View File

@@ -0,0 +1,30 @@
import { jest } from "@jest/globals";
const query = jest.fn();
const release = jest.fn(async () => {});
jest.unstable_mockModule("../../db/index.js", () => ({ getPool: async () => ({ query, release }) }));
const { getStorage } = await import("./storage.js");
beforeEach(() => {
query.mockReset();
release.mockClear();
});
describe("getStorage (core + audit in one query)", () => {
it("runs a single query and shapes on-disk/logical core/audit/total byte totals", async () => {
query.mockResolvedValue({
rows: [{ core_on_disk: "100", core_logical: "120", audit_on_disk: "50", audit_logical: "60" }],
});
const out = await getStorage(7);
expect(query).toHaveBeenCalledTimes(1); // combined round-trip
expect(query.mock.calls[0][1]).toEqual([7]);
expect(out).toEqual({
onDisk: { core: 100, audit: 50, total: 150 },
logical: { core: 120, audit: 60, total: 180 },
});
expect(release).toHaveBeenCalledTimes(1);
});
});