feat(driver-pwa): top-up fetches commission rate from backend (no hardcoded rate)

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
tremble7681andclaude-flow committed 2026-06-18 20:27:39 +10:00
1 parent b7dc826f0f
commit 479b9699ea
3 files changed
+19 -5

No files matched your search

@@ -2,14 +2,23 @@ import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { MemoryRouter } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
vi.mock("@/api/driver", () => ({
topup: vi.fn(async () => ({ order_id: "o9", pay_url: "https://qr.nspk.ru/x", commission: 52, total: 1052 })),
getCommission: vi.fn(async () => ({ rate: 0.052 })),
}));
import { TopupPage } from "./TopupPage";
import * as driver from "@/api/driver";
const wrap = () => render(<MemoryRouter><TopupPage /></MemoryRouter>);
const wrap = () => {
const qc = new QueryClient();
return render(
<QueryClientProvider client={qc}>
<MemoryRouter><TopupPage /></MemoryRouter>
</QueryClientProvider>
);
};
describe("TopupPage", () => {
it("keypad builds amount, shows total, and submits topup", async () => {