mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-25 10:42:45 +00:00
* fix(usage): retain last successful data when polls fail Keep the latest poll outcome separate from its successful snapshot so errors remain visible without discarding known usage or advancing its freshness. Preserve attempt timestamps for response ordering and isolate retained values by scoped login set. * fix(usage): preserve history through discovery failures A failed account-store read does not confirm that an account was removed. Retain its existing host mapping until successful discovery replaces it, without carrying mappings across agent launch environments.
23 lines
954 B
TypeScript
23 lines
954 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { formatAmount, formatResetLabel } from "./format";
|
|
|
|
describe("formatAmount", () => {
|
|
it("groups thousands in the app's language", () => {
|
|
expect(formatAmount(12345, "credits", "en")).toBe("12,345");
|
|
expect(formatAmount(12345, "requests", "en")).toBe("12,345");
|
|
expect(formatAmount(12345, "credits", "fr").replace(/\s/g, " ")).toBe("12 345");
|
|
});
|
|
|
|
it("formats dollars as the language writes currency", () => {
|
|
expect(formatAmount(1234.5, "usd", "en")).toBe("$1,234.50");
|
|
expect(formatAmount(1234.5, "usd", "fr").replace(/\s/g, " ")).toBe("1 234,50 $US");
|
|
});
|
|
});
|
|
|
|
it("retained reset times that have passed do not claim the quota is resetting", () => {
|
|
const past = "2000-01-01T00:00:00.000Z";
|
|
expect(formatResetLabel(past, true)).toBe("Reset time passed");
|
|
expect(formatResetLabel(past)).toBe("resetting now");
|
|
expect(formatResetLabel(null, true)).toBeNull();
|
|
});
|