Skip to content

Commit 904f9f9

Browse files
committed
test(pricing): cover compact fallback branches
Extend the LiteLLM fallback regression so it enters the compact-shape branch and then falls through to full-shape parsing when compact decoding fails. Also cover the undefined and non-empty catalog id branches for the models.dev compact key helper, matching the generator inputs called out during review.
1 parent 465d2bc commit 904f9f9

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎nix/models-dev-compact.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@ it('falls back to the source model id when the catalog id is empty', () => {
55
'anthropic/claude-sonnet-4',
66
);
77
});
8+
9+
it('falls back to the source model id when the catalog id is undefined', () => {
10+
expect(selectModelsDevPricingKey('anthropic/claude-sonnet-4', undefined)).toBe(
11+
'anthropic/claude-sonnet-4',
12+
);
13+
});
14+
15+
it('uses the catalog id when it is non-empty', () => {
16+
expect(selectModelsDevPricingKey('anthropic/claude-sonnet-4', 'catalog-id-123')).toBe(
17+
'catalog-id-123',
18+
);
19+
});

‎rust/crates/ccusage/src/pricing.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ mod tests {
14191419
r#"{
14201420
"gpt-full-with-extra-i": {
14211421
"i": "provider metadata",
1422+
"o": "provider metadata",
14221423
"input_cost_per_token": 0.000001,
14231424
"output_cost_per_token": 0.000010
14241425
}

0 commit comments

Comments
 (0)