Awesome Reviewers

Tests should assert the behavior contract precisely, include the missing coverage for changed code, and stay isolated/noisy-control friendly.

Key rules:

Example (identity + deep equality):

const options = mutationOptions({ mutationKey: ['key'], mutationFn: () => Promise.resolve(5) })
expect(options).toBe(options) // referential identity
expect(options).toStrictEqual({ mutationKey: ['key'], mutationFn: expect.any(Function) })

Example (time-based intermediate assertions):

render(BaseExample, { props: { options: { queries: [/* key1 resolves at 10ms, key2 at 20ms */] } } })
expect(getByText('Status 1: pending')).toBeInTheDocument()
await vi.advanceTimersByTimeAsync(11)
expect(getByText('Status 1: success')).toBeInTheDocument()
await vi.advanceTimersByTimeAsync(10)
expect(getByText('Status 2: success')).toBeInTheDocument()

Example (type-test style):

expectTypeOf(infiniteQueryOptions)
  .parameter(0)
  .not.toHaveProperty('stallTime')