Enhance ledger operations and referral lifecycle
Add traceable ledger filtering and permanent referral codes so operators can investigate credit activity without weakening immutable accounting guarantees.
This commit is contained in:
@@ -141,6 +141,36 @@ describe("adminApi", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("流水查询编码三维筛选、关联 ID 与金额排序", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(
|
||||
new Response(JSON.stringify({ items: [] }), {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
}),
|
||||
);
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
await adminApi.latestLedger({
|
||||
cursor: "next+/=",
|
||||
limit: 50,
|
||||
from: "2026-08-01T00:00:00.000Z",
|
||||
until: "2026-08-21T00:00:00.000Z",
|
||||
type: "settle",
|
||||
entryType: "USAGE_SETTLE",
|
||||
usageType: "hotword",
|
||||
referenceId: "11111111-1111-4111-8111-111111111111",
|
||||
sort: "amount",
|
||||
order: "asc",
|
||||
});
|
||||
|
||||
const url = String(fetchMock.mock.calls[0]?.[0]);
|
||||
expect(url).toContain("cursor=next%2B%2F%3D&limit=50");
|
||||
expect(url).toContain("type=settle&entryType=USAGE_SETTLE&usageType=hotword");
|
||||
expect(url).toContain(
|
||||
"referenceId=11111111-1111-4111-8111-111111111111&sort=amount&order=asc",
|
||||
);
|
||||
});
|
||||
|
||||
it("缺少 CSRF 时在发送变更请求前失败", async () => {
|
||||
const fetchMock = vi.fn();
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
Reference in New Issue
Block a user