Files
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

15 lines
586 B
TypeScript

import { describe, it, expect } from 'vitest';
import { makeAllowlistGate } from '@/lib/agent/runtime/allowlist';
describe('allowlist gate', () => {
const gate = makeAllowlistGate(new Set(['regenerate_scene_actions']));
it('allows a listed tool', async () => {
expect(await gate({ toolCall: { name: 'regenerate_scene_actions' } } as never)).toBeUndefined();
});
it('blocks an unlisted tool with a reason', async () => {
const r = await gate({ toolCall: { name: 'rm_rf' } } as never);
expect(r?.block).toBe(true);
expect(r?.reason).toContain('rm_rf');
});
});