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