stats.test.js
1 import { describe, expect, it } from 'vitest'; 2 import { getRegistry } from '@jackwener/opencli/registry'; 3 import './stats.js'; 4 describe('douyin stats registration', () => { 5 it('registers the stats command', () => { 6 const registry = getRegistry(); 7 const cmd = [...registry.values()].find(c => c.site === 'douyin' && c.name === 'stats'); 8 expect(cmd).toBeDefined(); 9 expect(cmd?.args.some(a => a.name === 'aweme_id')).toBe(true); 10 }); 11 it('has expected columns', () => { 12 const registry = getRegistry(); 13 const cmd = [...registry.values()].find(c => c.site === 'douyin' && c.name === 'stats'); 14 expect(cmd?.columns).toContain('metric'); 15 expect(cmd?.columns).toContain('value'); 16 }); 17 it('uses COOKIE strategy', () => { 18 const registry = getRegistry(); 19 const cmd = [...registry.values()].find(c => c.site === 'douyin' && c.name === 'stats'); 20 expect(cmd?.strategy).toBe('cookie'); 21 }); 22 });