Problem
test/costs.test.ts duplicates the MODEL_PRICING constant and calcCost() function instead of importing them from the source module. This means:
- Tests won't catch if the pricing values change in the source
- Tests could pass even when source is broken
- Maintenance burden of keeping two copies in sync
Location
- Source:
src/lib/costs.ts
- Test:
test/costs.test.ts
Current (Bad) Pattern
// test/costs.test.ts - DUPLICATED
const MODEL_PRICING: Record<string, { input: number; output: number }> = {
'claude-opus-4-5-20251101': { input: 15.0, output: 75.0 },
// ... duplicate of source
};
function calcCost(model: string, inputTokens: number, outputTokens: number): number {
// ... duplicate of source
}
Recommended Fix
Export the constant and function from source, then import in tests:
// src/lib/costs.ts
export const MODEL_PRICING = { ... };
export function calcCost(...) { ... }
// test/costs.test.ts
import { calcCost, MODEL_PRICING } from '../src/lib/costs.js';
describe('costs utilities', () => {
// Now tests the actual implementation
});
Priority
P3 - Test quality improvement. Not blocking but should be fixed before adding more cost-related tests.
Problem
test/costs.test.tsduplicates theMODEL_PRICINGconstant andcalcCost()function instead of importing them from the source module. This means:Location
src/lib/costs.tstest/costs.test.tsCurrent (Bad) Pattern
Recommended Fix
Export the constant and function from source, then import in tests:
Priority
P3 - Test quality improvement. Not blocking but should be fixed before adding more cost-related tests.