chore(lint): burn down remaining warnings to zero

This commit is contained in:
William Valentin
2026-02-15 23:14:21 -08:00
parent 49b752e8b0
commit 948d4ac6d8
67 changed files with 235 additions and 256 deletions
+20 -5
View File
@@ -1,6 +1,7 @@
import { describe, it, expect, vi } from 'vitest';
import { ToolRegistry } from './registry.js';
import type { Tool } from './types.js';
import type { ToolPolicy } from './policy.js';
const echoTool: Tool = {
name: 'test.echo',
@@ -114,8 +115,13 @@ describe('ToolRegistry', () => {
it('inherits the policy from original', () => {
const reg = new ToolRegistry();
const mockPolicy = { filterTools: vi.fn(), isAllowed: vi.fn(), resolveAllowedNames: vi.fn(), getEffectiveProfile: vi.fn() };
reg.setPolicy(mockPolicy as any);
const mockPolicy: ToolPolicy = {
filterTools: vi.fn((tools) => tools),
isAllowed: vi.fn(() => true),
resolveAllowedNames: vi.fn(() => new Set()),
getEffectiveProfile: vi.fn(() => ({ profile: 'full', source: 'explicit' })),
};
reg.setPolicy(mockPolicy);
const cloned = reg.clone();
expect(cloned.getPolicy()).toBe(mockPolicy);
@@ -131,8 +137,13 @@ describe('ToolRegistry', () => {
replacementTool.description = 'Sandboxed version';
cloned.replace(replacementTool);
expect(cloned.get('shell.exec')!.description).toBe('Sandboxed version');
expect(reg.get('shell.exec')!.description).toBe('Mock shell.exec');
const clonedTool = cloned.get('shell.exec');
const originalToolFromReg = reg.get('shell.exec');
if (!clonedTool || !originalToolFromReg) {
throw new Error('Expected shell.exec to exist in both registries');
}
expect(clonedTool.description).toBe('Sandboxed version');
expect(originalToolFromReg.description).toBe('Mock shell.exec');
});
});
@@ -153,7 +164,11 @@ describe('ToolRegistry', () => {
replacement.description = 'New description';
reg.replace(replacement);
expect(reg.get('tool.a')!.description).toBe('New description');
const replaced = reg.get('tool.a');
if (!replaced) {
throw new Error('Expected tool.a to be present');
}
expect(replaced.description).toBe('New description');
});
it('throws if tool does not exist', () => {