invariant.spec.ts 785 B

123456789101112131415161718
  1. import { describe, expect, it, vi } from 'vitest'
  2. import * as invariant from '@deepseek-ai/dsh-command-compact/invariant'
  3. describe('command-compact invariant companion', () => {
  4. it('registers the package-owned no-op installer', async () => {
  5. const register = vi.fn().mockReturnValue(() => {})
  6. const ctx = { invariants: { register } } as never
  7. const dispose = await invariant.apply(ctx)
  8. expect(invariant.name).toBe('command-compact-invariant')
  9. expect(invariant.inject).toEqual(['invariants'])
  10. expect(register).toHaveBeenCalledWith('@deepseek-ai/dsh-command-compact', expect.any(Function))
  11. expect(() => {
  12. const install = register.mock.calls[0]![1] as () => void
  13. install()
  14. }).not.toThrow()
  15. expect(dispose).toBeTypeOf('function')
  16. })
  17. })