feat: manage owner usage history records

This commit is contained in:
Wyndham ARR
2026-08-03 16:43:27 +08:00
parent 393b841023
commit 84443d5dba
17 changed files with 798 additions and 102 deletions

View File

@@ -160,3 +160,19 @@ test("usage creation sends only the supplied API contract", async () => {
assert.equal("use" in JSON.parse(captured.options.body), false);
assert.equal("balance" in JSON.parse(captured.options.body), false);
});
test("usage deletion uses the record route and DELETE method", async () => {
let captured;
const api = loadClient({
search: "?mode=api",
fetchImpl: async (url, options) => {
captured = { url, options };
return jsonResponse(null, 204);
}
});
await api.client.deleteUsageRecord("00000000-0000-4000-8000-000000000002");
assert.equal(captured.url.pathname, "/usage-records/00000000-0000-4000-8000-000000000002");
assert.equal(captured.options.method, "DELETE");
assert.equal(captured.options.credentials, "include");
assert.equal(captured.options.body, undefined);
});