|
| 1 | +import { describe, it, expect } from 'vitest' |
| 2 | + |
| 3 | +import { getModelCosts, getShortModelName } from '../src/models.js' |
| 4 | + |
| 5 | +// Verifies MiniMax pricing loaded from FALLBACK_PRICING (no network call). |
| 6 | +// pricingCache stays null until loadPricing() runs, so getModelCosts falls |
| 7 | +// through to FALLBACK_PRICING which is what we want to validate here. |
| 8 | + |
| 9 | +describe('MiniMax model pricing', () => { |
| 10 | + it('returns pricing for MiniMax-M2.7', () => { |
| 11 | + const costs = getModelCosts('MiniMax-M2.7') |
| 12 | + expect(costs).not.toBeNull() |
| 13 | + expect(costs!.inputCostPerToken).toBe(0.3e-6) |
| 14 | + expect(costs!.outputCostPerToken).toBe(1.2e-6) |
| 15 | + expect(costs!.cacheReadCostPerToken).toBe(0.06e-6) |
| 16 | + expect(costs!.cacheWriteCostPerToken).toBe(0.375e-6) |
| 17 | + expect(costs!.fastMultiplier).toBe(1) |
| 18 | + }) |
| 19 | + |
| 20 | + it('returns pricing for MiniMax-M2.7-highspeed', () => { |
| 21 | + const costs = getModelCosts('MiniMax-M2.7-highspeed') |
| 22 | + expect(costs).not.toBeNull() |
| 23 | + expect(costs!.inputCostPerToken).toBe(0.6e-6) |
| 24 | + expect(costs!.outputCostPerToken).toBe(2.4e-6) |
| 25 | + expect(costs!.cacheReadCostPerToken).toBe(0.06e-6) |
| 26 | + expect(costs!.cacheWriteCostPerToken).toBe(0.375e-6) |
| 27 | + expect(costs!.fastMultiplier).toBe(1) |
| 28 | + }) |
| 29 | + |
| 30 | + it('highspeed pricing is distinct from base model pricing', () => { |
| 31 | + const base = getModelCosts('MiniMax-M2.7') |
| 32 | + const fast = getModelCosts('MiniMax-M2.7-highspeed') |
| 33 | + expect(fast!.inputCostPerToken).toBeGreaterThan(base!.inputCostPerToken) |
| 34 | + expect(fast!.outputCostPerToken).toBeGreaterThan(base!.outputCostPerToken) |
| 35 | + }) |
| 36 | + |
| 37 | + it('returns short name for MiniMax-M2.7', () => { |
| 38 | + expect(getShortModelName('MiniMax-M2.7')).toBe('MiniMax M2.7') |
| 39 | + }) |
| 40 | + |
| 41 | + it('returns short name for MiniMax-M2.7-highspeed', () => { |
| 42 | + expect(getShortModelName('MiniMax-M2.7-highspeed')).toBe('MiniMax M2.7 Highspeed') |
| 43 | + }) |
| 44 | + |
| 45 | + it('handles MiniMax model ID with date suffix', () => { |
| 46 | + expect(getShortModelName('MiniMax-M2.7-20260101')).toBe('MiniMax M2.7') |
| 47 | + }) |
| 48 | +}) |
0 commit comments