-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathshow.test.ts
More file actions
100 lines (90 loc) · 2.53 KB
/
Copy pathshow.test.ts
File metadata and controls
100 lines (90 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { describe, it, expect, mock } from 'bun:test';
import { default as showCommand } from '../../../src/commands/config/show';
// Mock file I/O
mock.module('../../../src/config/loader', () => ({
readConfigFile: () => ({
api_key: 'sk-cp-test-key',
default_text_model: 'MiniMax-M2.5',
default_speech_model: 'speech-2.8-hd',
default_video_model: 'MiniMax-Hailuo-2.3-6s-768p',
default_music_model: 'music-2.6',
}),
}));
describe('config show command', () => {
it('has correct name', () => {
expect(showCommand.name).toBe('config show');
});
it('shows configuration', async () => {
const config = {
apiKey: 'test-key',
region: 'global' as const,
baseUrl: 'https://api.mmx.io',
output: 'json' as const,
timeout: 300,
verbose: false,
quiet: false,
noColor: true,
yes: false,
dryRun: false,
nonInteractive: true,
async: false,
};
const originalLog = console.log;
let output = '';
console.log = (msg: string) => { output += msg; };
try {
await showCommand.execute(config, {
quiet: false,
verbose: false,
noColor: true,
yes: false,
dryRun: false,
help: false,
nonInteractive: true,
async: false,
});
const parsed = JSON.parse(output);
expect(parsed.base_url).toBe('https://api.mmx.io');
expect(parsed.timeout).toBe(300);
} finally {
console.log = originalLog;
}
});
it('includes default models in output', async () => {
const config = {
region: 'global' as const,
baseUrl: 'https://api.mmx.io',
output: 'json' as const,
timeout: 300,
verbose: false,
quiet: false,
noColor: true,
yes: false,
dryRun: false,
nonInteractive: true,
async: false,
};
const originalLog = console.log;
let output = '';
console.log = (msg: string) => { output += msg; };
try {
await showCommand.execute(config, {
quiet: false,
verbose: false,
noColor: true,
yes: false,
dryRun: false,
help: false,
nonInteractive: true,
async: false,
});
const parsed = JSON.parse(output);
expect(parsed.default_text_model).toBe('MiniMax-M2.5');
expect(parsed.default_speech_model).toBe('speech-2.8-hd');
expect(parsed.default_video_model).toBe('MiniMax-Hailuo-2.3-6s-768p');
expect(parsed.default_music_model).toBe('music-2.6');
} finally {
console.log = originalLog;
}
});
});