|
1 | 1 | import { describe, it, expect } from 'bun:test'; |
2 | 2 | import { musicGenerateModel, musicCoverModel, isCodingPlan } from '../../../src/commands/music/models'; |
| 3 | +import type { Config } from '../../../src/config/schema'; |
3 | 4 |
|
4 | 5 | describe('music models', () => { |
5 | 6 | it('isCodingPlan returns true for sk-cp- key', () => { |
6 | | - expect(isCodingPlan({ apiKey: 'sk-cp-abc' } as any)).toBe(true); |
| 7 | + expect(isCodingPlan({ apiKey: 'sk-cp-abc' } as Config)).toBe(true); |
7 | 8 | }); |
8 | 9 |
|
9 | 10 | it('isCodingPlan returns false for sk-api- key', () => { |
10 | | - expect(isCodingPlan({ apiKey: 'sk-api-xyz' } as any)).toBe(false); |
| 11 | + expect(isCodingPlan({ apiKey: 'sk-api-xyz' } as Config)).toBe(false); |
11 | 12 | }); |
12 | 13 |
|
13 | 14 | it('musicGenerateModel uses defaultMusicModel when set', () => { |
14 | | - const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as any; |
| 15 | + const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as Config; |
15 | 16 | expect(musicGenerateModel(config)).toBe('music-2.6'); |
16 | 17 | }); |
17 | 18 |
|
18 | 19 | it('musicGenerateModel falls back to key-type default when no defaultMusicModel', () => { |
19 | | - const cpConfig = { apiKey: 'sk-cp-abc' } as any; |
| 20 | + const cpConfig = { apiKey: 'sk-cp-abc' } as Config; |
20 | 21 | expect(musicGenerateModel(cpConfig)).toBe('music-2.6'); |
21 | 22 |
|
22 | | - const apiConfig = { apiKey: 'sk-api-xyz' } as any; |
| 23 | + const apiConfig = { apiKey: 'sk-api-xyz' } as Config; |
23 | 24 | expect(musicGenerateModel(apiConfig)).toBe('music-2.6-free'); |
24 | 25 | }); |
25 | 26 |
|
26 | 27 | it('musicCoverModel ignores defaultMusicModel for non-cover models', () => { |
27 | | - // defaultMusicModel is 'music-2.6' (a generate model, not a cover model) |
28 | | - // cover should still use key-type default |
29 | | - const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as any; |
| 28 | + const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as Config; |
30 | 29 | expect(musicCoverModel(config)).toBe('music-cover-free'); |
31 | 30 | }); |
32 | 31 |
|
33 | 32 | it('musicCoverModel uses key-type default when no defaultMusicModel', () => { |
34 | | - const cpConfig = { apiKey: 'sk-cp-abc' } as any; |
| 33 | + const cpConfig = { apiKey: 'sk-cp-abc' } as Config; |
35 | 34 | expect(musicCoverModel(cpConfig)).toBe('music-cover'); |
36 | 35 |
|
37 | | - const apiConfig = { apiKey: 'sk-api-xyz' } as any; |
| 36 | + const apiConfig = { apiKey: 'sk-api-xyz' } as Config; |
38 | 37 | expect(musicCoverModel(apiConfig)).toBe('music-cover-free'); |
39 | 38 | }); |
40 | 39 | }); |
0 commit comments