fix(frontend): complete audit remediation

This commit is contained in:
2026-09-06 19:49:02 +03:00
parent c97f62bd98
commit 9e42148f6a
11 changed files with 508 additions and 72 deletions
@@ -7,6 +7,22 @@ import { server } from "@/test/server";
import { useBrokerageEvents } from "./useBrokerageEvents";
describe("useBrokerageEvents", () => {
it("does not fetch events without an account ID", async () => {
configureAuthClient({
accessToken: () => "token",
refresh: async () => true,
clear: vi.fn(),
});
const requested = vi.fn(() => HttpResponse.json({ events: [] }));
server.use(
http.get("*/api/v1/brokerage-accounts/:accountId/events", requested),
);
const { result } = renderHook(() => useBrokerageEvents(undefined), {
wrapper: createQueryWrapper().wrapper,
});
await waitFor(() => expect(result.current.fetchStatus).toBe("idle"));
expect(requested).not.toHaveBeenCalled();
});
it("loads future cash events through the authenticated query seam", async () => {
configureAuthClient({
accessToken: () => "token",