1
0

invariant.spec.ts 712 B

12345678910111213141516
  1. import { describe, expect, it, vi } from 'vitest'
  2. import { apply, inject, name } from '../src/invariant.ts'
  3. describe('win32-process invariant companion', () => {
  4. it('registers the package-owned empty invariant', async () => {
  5. const dispose = vi.fn()
  6. const register = vi.fn((_packageName: string, _installer: () => void) => dispose)
  7. const ctx = { invariants: { register } } as never
  8. await expect(apply(ctx)).resolves.toBe(dispose)
  9. expect(name).toBe('win32-process-invariant')
  10. expect(inject).toEqual(['invariants'])
  11. expect(register).toHaveBeenCalledWith('@deepseek-ai/dsh-win32-process', expect.any(Function))
  12. const installer = register.mock.calls[0]![1]
  13. installer()
  14. })
  15. })