/ src / completion.test.ts
completion.test.ts
 1  import { describe, expect, it, vi } from 'vitest';
 2  
 3  const { mockGetRegistry } = vi.hoisted(() => ({
 4    mockGetRegistry: vi.fn(() => new Map([
 5      ['github/issues', { site: 'github', name: 'issues' }],
 6    ])),
 7  }));
 8  
 9  vi.mock('./registry.js', () => ({
10    getRegistry: mockGetRegistry,
11  }));
12  
13  import { getCompletions } from './completion.js';
14  
15  describe('getCompletions', () => {
16    it('includes top-level built-ins that are registered outside the site registry', () => {
17      const completions = getCompletions([], 1);
18  
19      expect(completions).toContain('plugin');
20      expect(completions).toContain('install');
21      expect(completions).toContain('register');
22      expect(completions).not.toContain('setup');
23    });
24  
25    it('still includes discovered site names', () => {
26      const completions = getCompletions([], 1);
27  
28      expect(completions).toContain('github');
29    });
30  });