|
| 1 | +import { describe, it, expect } from 'bun:test'; |
| 2 | + |
| 3 | +describe('text repl command', () => { |
| 4 | + it('is importable and has correct metadata', async () => { |
| 5 | + const mod = await import('../../../src/commands/text/repl'); |
| 6 | + const cmd = mod.default; |
| 7 | + |
| 8 | + expect(cmd.name).toBe('text repl'); |
| 9 | + expect(cmd.description).toContain('interactive'); |
| 10 | + expect(cmd.options).toBeDefined(); |
| 11 | + expect(cmd.options.length).toBeGreaterThan(0); |
| 12 | + |
| 13 | + // Verify key options exist |
| 14 | + const flags = cmd.options.map((o: { flag: string }) => o.flag); |
| 15 | + expect(flags.some((f: string) => f.includes('model'))).toBe(true); |
| 16 | + expect(flags.some((f: string) => f.includes('system'))).toBe(true); |
| 17 | + expect(flags.some((f: string) => f.includes('max-tokens'))).toBe(true); |
| 18 | + }); |
| 19 | + |
| 20 | + it('rejects non-interactive mode', async () => { |
| 21 | + const mod = await import('../../../src/commands/text/repl'); |
| 22 | + const cmd = mod.default; |
| 23 | + |
| 24 | + const config = { |
| 25 | + region: 'global' as const, |
| 26 | + baseUrl: 'https://api.minimax.io', |
| 27 | + output: 'text' as const, |
| 28 | + timeout: 300, |
| 29 | + verbose: false, |
| 30 | + quiet: false, |
| 31 | + noColor: true, |
| 32 | + yes: false, |
| 33 | + dryRun: false, |
| 34 | + nonInteractive: true, |
| 35 | + async: false, |
| 36 | + }; |
| 37 | + |
| 38 | + const flags = { |
| 39 | + apiKey: 'sk-test', |
| 40 | + region: 'global' as const, |
| 41 | + baseUrl: 'https://api.minimax.io', |
| 42 | + output: 'text' as const, |
| 43 | + timeout: 300, |
| 44 | + quiet: false, |
| 45 | + verbose: false, |
| 46 | + noColor: true, |
| 47 | + dryRun: false, |
| 48 | + nonInteractive: true, |
| 49 | + help: false, |
| 50 | + version: false, |
| 51 | + async: false, |
| 52 | + yes: false, |
| 53 | + _positional: [] as string[], |
| 54 | + }; |
| 55 | + |
| 56 | + await expect(cmd.execute(config, flags)).rejects.toThrow('interactive'); |
| 57 | + }); |
| 58 | +}); |
0 commit comments