Files
EasyCLIProxyAPI/tests/usageProvider.test.ts
lzt404 dfba9b019f feat: improve request pricing, model diagnostics, and client discovery
- Align response model handling with CPA-Manager-Plus and flag routing mismatches
- Add per-request costs and CSV export; fix mixed-context cost aggregation
- Display API-reported access types and move providers next to timestamps
- Use white table backgrounds and simplify cost and status displays
- Expand client discovery paths, validate executables, and prioritize installed clients
- Add model, pricing, client discovery, and UI regression tests
2026-10-04 17:31:52 +08:00

15 lines
882 B
TypeScript

import { expect, test } from 'bun:test';
import { usageProviderDetails } from '../src/services/usageProvider';
test('usage API authentication distinguishes API routes from OAuth', () => {
expect(usageProviderDetails('codex', 'apikey')).toMatchObject({ name: 'Codex', access: 'API' });
expect(usageProviderDetails('codex', 'oauth')).toMatchObject({ name: 'Codex', access: 'OAuth' });
expect(usageProviderDetails(' My gateway ', 'apikey')).toMatchObject({ name: 'My gateway', access: 'API' });
});
test('missing or new API values are not guessed from model or credentials', () => {
expect(usageProviderDetails('codex')).toMatchObject({ name: 'Codex', access: '' });
expect(usageProviderDetails('', 'unknown')).toMatchObject({ name: '—', access: '' });
expect(usageProviderDetails('custom', 'new-method')).toMatchObject({ name: 'custom', access: 'new-method' });
});