test(runtimes): pin combined provider+dotted+dated Claude normalization (#2657)

Adds a regression test for `anthropic/claude-opus-4.7-20251001` that
exercises all three resolvePricing tolerances at once (provider strip,
Claude dot→dash, date trim). Each step was already covered pairwise;
this nails down their composition so a future change to candidate
ordering can't silently drop a step.

Follow-up to #2654 (MUL-2243); raised in second review.

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
Bohan Jiang
2026-05-15 12:35:31 +08:00
committed by GitHub
parent 833032ed9c
commit 968ef1ca84

View File

@@ -89,6 +89,20 @@ describe("estimateCost", () => {
expect(cost).toBeCloseTo(1, 5);
});
it("prices the full provider+dotted+dated form (anthropic/claude-opus-4.7-20251001)", () => {
// All three normalization steps must compose: strip `anthropic/`,
// dot→dash on the Claude ID, and trim the date stamp. Pins the
// combined path so a future change to candidate ordering can't
// silently drop one tolerance.
const cost = estimateCost({
...zeroUsage,
model: "anthropic/claude-opus-4.7-20251001",
input_tokens: 1_000_000,
output_tokens: 1_000_000,
});
expect(cost).toBeCloseTo(5 + 25, 5);
});
it("prices each dotted Codex catalog SKU at its own tier, not gpt-5", () => {
// Every dotted minor version is priced independently. The resolver does
// exact-match-after-date-strip (no startsWith fallback), so each row