54241e6b6c
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { decide } from './enforce-todowrite-skill-verifier.mjs';
|
|
|
|
describe('enforce-todowrite-skill-verifier decide()', () => {
|
|
it('allows when all completed mentions actually invoked Skill', () => {
|
|
const todoItems = [
|
|
{ content: 'invoke superpowers:brainstorming', status: 'completed' },
|
|
];
|
|
const transcript = [
|
|
{ type: 'tool_use', name: 'Skill', input: { skill: 'superpowers:brainstorming' } },
|
|
];
|
|
expect(decide({ todoItems, transcript }).block).toBe(false);
|
|
});
|
|
it('blocks when completed mention has NO matching Skill call', () => {
|
|
const todoItems = [
|
|
{ content: 'invoke superpowers:brainstorming', status: 'completed' },
|
|
];
|
|
const transcript = [];
|
|
const r = decide({ todoItems, transcript });
|
|
expect(r.block).toBe(true);
|
|
expect(r.reason).toMatch(/v4\.1 TodoWrite hard sync/);
|
|
});
|
|
it('allows when mention is pending (not completed)', () => {
|
|
const todoItems = [
|
|
{ content: 'invoke superpowers:brainstorming', status: 'pending' },
|
|
];
|
|
expect(decide({ todoItems, transcript: [] }).block).toBe(false);
|
|
});
|
|
it('allows when todoItems is empty', () => {
|
|
expect(decide({ todoItems: [], transcript: [] }).block).toBe(false);
|
|
});
|
|
});
|