Skip to content

Commit

Permalink
fix lazy-decorated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unnoq committed Dec 20, 2024
1 parent 1be1bc6 commit 72c8579
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/server/src/lazy-decorated.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { decorateLazy } from './lazy-decorated'
import { Procedure } from './procedure'
import { createProcedureClient } from './procedure-client'

vi.mock('./procedure-caller', () => ({
createProcedureCaller: vi.fn(() => vi.fn()),
vi.mock('./procedure-client', () => ({
createProcedureClient: vi.fn(() => vi.fn()),
}))

beforeEach(() => {
Expand Down Expand Up @@ -74,8 +74,7 @@ describe('decorated lazy', () => {
context: undefined,
})
expect(vi.mocked(createProcedureClient).mock.calls[0]![0].procedure).toSatisfy(isLazy)
const unwrapped = await unlazy(vi.mocked(createProcedureClient).mock.calls[0]![0].procedure as any)
expect(unwrapped.default).toBe(router)
expect(unlazy(vi.mocked(createProcedureClient).mock.calls[0]![0].procedure as any)).rejects.toThrow('Expected a lazy<procedure> but got lazy<unknown>')

expect(await decorated({ val: '1' }, { signal })).toBe('__mocked__')
expect(caller).toHaveBeenCalledTimes(1)
Expand Down

0 comments on commit 72c8579

Please sign in to comment.