refactor: align frontend ownership boundaries
Close audit gaps across API drift, query policy, UI, and tests.
This commit is contained in:
@@ -52,6 +52,14 @@ const handlers = [
|
||||
events: [],
|
||||
}),
|
||||
),
|
||||
http.get("*/api/v1/brokerage-accounts/:accountId/income-summary", () =>
|
||||
HttpResponse.json({
|
||||
accountId: "account-1",
|
||||
period: { from: "2026-01-01", to: "2026-08-14" },
|
||||
totalsByCurrency: [],
|
||||
calculatedAt: "2026-08-14T00:00:00Z",
|
||||
}),
|
||||
),
|
||||
];
|
||||
|
||||
export { handlers };
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
|
||||
function createTestQueryClient(): QueryClient {
|
||||
return new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: { retry: false },
|
||||
mutations: { retry: false },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function createQueryWrapper(queryClient = createTestQueryClient()) {
|
||||
const QueryWrapper: FC<PropsWithChildren> = (props) => (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{props.children}
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
return { queryClient, wrapper: QueryWrapper };
|
||||
}
|
||||
|
||||
export { createQueryWrapper, createTestQueryClient };
|
||||
+7
-1
@@ -1,10 +1,16 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { cleanup } from "@testing-library/react";
|
||||
import { afterAll, afterEach, beforeAll } from "vitest";
|
||||
import { configureAuthClient } from "@/shared/api";
|
||||
import "../shared/i18n";
|
||||
import { server } from "./server";
|
||||
|
||||
beforeAll(() => server.listen({ onUnhandledRequest: "error" }));
|
||||
afterEach(() => server.resetHandlers());
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
configureAuthClient(null);
|
||||
server.resetHandlers();
|
||||
});
|
||||
afterAll(() => server.close());
|
||||
|
||||
class ResizeObserver {
|
||||
|
||||
Reference in New Issue
Block a user