Files
openmaic/OpenMAIC/tests/lib/agent/runtime/allowlist.test.ts
2026-08-16 14:58:47 +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');
});
});