Author SHA1 Message Date
ksv741 850823e1f5 feat: clarify grouped coupon payouts (WealthLedger/frontend#162)
Frontend verify / commits (pull_request) Successful in 31s
Frontend verify / verify (pull_request) Successful in 6m27s
Frontend verify / commits (pull_request) Successful in 30s
Frontend verify / security (pull_request) Successful in 10s
2026-11-07 10:51:05 +03:00
2 changed files with 6 additions and 29 deletions
@@ -10,9 +10,6 @@ import { server } from "@/test/server";
import { useScreenSync } from "../index";
const TRANSPORT_ATTEMPTS = 3;
const TRANSPORT_RECOVERY_MS = 3000;
function auth() {
configureAuthClient({
accessToken: () => "synthetic",
@@ -31,13 +28,11 @@ describe("read-only screen synchronization", () => {
gets += 1;
syncModes.push(new URL(request.url).searchParams.get("sync"));
// The transport retries a transient read twice (1 s, 2 s) on its own.
return gets <= TRANSPORT_ATTEMPTS
return gets === 1
? HttpResponse.json({ code: "TBANK_UNAVAILABLE" }, { status: 503 })
: HttpResponse.json(resource([]));
}),
);
vi.useFakeTimers();
const { result } = renderHook(
() => {
@@ -51,26 +46,12 @@ describe("read-only screen synchronization", () => {
{ wrapper: createQueryWrapper().wrapper },
);
try {
// Exhaust the transport back-off so the query settles in error.
await vi.waitFor(async () => {
await act(() => vi.advanceTimersByTimeAsync(TRANSPORT_RECOVERY_MS));
expect(result.current.sync.transportError).toBe(true);
});
expect(gets).toBe(TRANSPORT_ATTEMPTS);
await waitFor(() => expect(gets).toBe(1));
await act(async () => result.current.sync.retry());
await waitFor(() => expect(result.current.accounts.data).toEqual([]));
await act(async () => result.current.sync.retry());
await vi.waitFor(async () => {
await act(() => vi.advanceTimersByTimeAsync(0));
expect(result.current.accounts.data).toEqual([]);
});
}
finally {
vi.useRealTimers();
}
expect(gets).toBe(TRANSPORT_ATTEMPTS + 1);
expect(syncModes).toEqual(Array.from({ length: gets }, () => null));
expect(gets).toBe(2);
expect(syncModes).toEqual([null, null]);
});
it("refreshes the currently open resources together", async () => {
-4
View File
@@ -1,6 +1,5 @@
import "@testing-library/jest-dom/vitest";
import { cleanup, configure } from "@testing-library/react";
import { MotionGlobalConfig } from "motion/react";
import { afterAll, afterEach, beforeAll, vi } from "vitest";
import { configureAuthClient } from "@/shared/api";
@@ -11,9 +10,6 @@ import { server } from "./server";
// Allow async UI updates on the slower CI runner; local waits stay unchanged.
if (process.env.CI) configure({ asyncUtilTimeout: 5000 });
// Route fades start at opacity 0; under load toBeVisible can catch that frame.
MotionGlobalConfig.skipAnimations = true;
beforeAll(() => server.listen({ onUnhandledRequest: "error" }));
afterEach(() => {
cleanup();