import { describe, expect, test } from "vitest";
import {
    residualDiamondsPerUsdToRate,
    residualRateLabel,
    residualRateToDiamondsPerUsd,
} from "@/features/host-agency-policy/residualRate.js";

describe("host agency residual diamond rate", () => {
    test("submits diamonds per USD as backend USD-per-diamond rate", () => {
        expect(residualDiamondsPerUsdToRate("100")).toBe("0.01");
        expect(residualDiamondsPerUsdToRate("1000000")).toBe("0.000001");
        expect(residualDiamondsPerUsdToRate("0")).toBe("0");
    });

    test("displays backend rate as diamonds per USD", () => {
        expect(residualRateToDiamondsPerUsd("0.01")).toBe("100");
        expect(residualRateLabel("0.01")).toBe("剩余钻石 100钻石=1美元");
        expect(residualRateLabel("0")).toBe("剩余钻石不折美元");
    });
});
