diff --git a/packages/pulse/src/guard-projection.test.ts b/packages/pulse/src/guard-projection.test.ts index 1e2f00b..ad4abe8 100644 --- a/packages/pulse/src/guard-projection.test.ts +++ b/packages/pulse/src/guard-projection.test.ts @@ -6,10 +6,11 @@ import { clearGuardExpressionCache, getGuardState, GuardViolationError, + initGuardSchema, matchEventKindPattern, registerGuard, -} from './guard-projection.js'; -import { createScopedStore } from './store.js'; +} from './guard-projection.ts'; +import { createScopedStore } from './store.ts'; function mkScoped() { const root = mkdtempSync(join(tmpdir(), 'pulse-guard-')); @@ -17,7 +18,10 @@ function mkScoped() { basePath: join(root, 'scopes'), objectsDir: join(root, 'objects'), }); - return { root, scoped, db: scoped.scopeDatabase('g'), store: scoped.scope('g') }; + const store = scoped.scope('g'); + const db = scoped.scopeDatabase('g'); + initGuardSchema(db); + return { root, scoped, db, store }; } let last: ReturnType | null = null; @@ -82,13 +86,13 @@ test('illegal event rejected when task already open', async () => { occurredAt: 1, }); - expect(async () => { - await store.appendEvent({ + await expect( + store.appendEvent({ kind: 'task.created', key: 't1', occurredAt: 2, - }); - }).toThrow(GuardViolationError); + }), + ).rejects.toThrow(GuardViolationError); }); test('state transitions created → claimed → completed', async () => {