feat(invariants): implement package runtime checks
This commit is contained in:
26
packages/hooks/hooks-codex/tests/invariant.spec.ts
Normal file
26
packages/hooks/hooks-codex/tests/invariant.spec.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { Context } from 'cordis'
|
||||
import type { BashExecutor } from '@deepseek-ai/dsh-bash'
|
||||
|
||||
describe('Codex hook package invariant', () => {
|
||||
it('rejects a partially installed hook listener set', async () => {
|
||||
const ctx = new Context()
|
||||
await ctx.plugin({
|
||||
name: 'codex-invariant-bash',
|
||||
apply(child: Context) {
|
||||
child.provide('bash', {
|
||||
resolve() {},
|
||||
async run() {},
|
||||
start() {},
|
||||
} as unknown as BashExecutor)
|
||||
},
|
||||
})
|
||||
await expect(ctx.plugin({
|
||||
name: 'hooks-codex',
|
||||
inject: ['bash'],
|
||||
apply(child: Context) {
|
||||
child.effect(() => () => {}, 'ctx.on("agent/session-start")')
|
||||
},
|
||||
})).rejects.toThrow(/must install its complete listener set atomically/)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user