import { describe, it, expect } from 'vitest'; import { makeWorkersTools } from '../../src/tools/workers.js'; describe('worker.register (stub)', () => { const tool = makeWorkersTools().find((t) => t.name === 'worker.register')!; it('exists and documents itself as a stub', () => { expect(tool).toBeDefined(); expect(tool.description.toLowerCase()).toContain('stub'); }); it('returns a 501 not-implemented verdict for valid input', async () => { const r = await tool.handler({ machine: 'win11', runtime: 'claude-opus', capabilities: ['needs-db'], }); expect(r.isError).toBe(true); const body = JSON.parse(r.content[0].text); expect(body.ok).toBe(false); expect(body.reason).toBe('not-implemented'); expect(typeof body.hint).toBe('string'); expect(body.hint.length).toBeGreaterThan(0); }); it('keeps the verdict for optional endpoint + confirm (no side-effects)', async () => { const r = await tool.handler({ machine: 'win11', runtime: 'claude-opus', capabilities: [], endpoint: 'https://node/agent', confirm: true, }); const body = JSON.parse(r.content[0].text); expect(body.reason).toBe('not-implemented'); }); it('rejects malformed input — missing machine', async () => { await expect( tool.handler({ runtime: 'claude-opus', capabilities: [] }), ).rejects.toThrow(); }); it('rejects malformed input — capabilities not an array', async () => { await expect( tool.handler({ machine: 'm', runtime: 'r', capabilities: 'nope' }), ).rejects.toThrow(); }); });