Skip to content

Commit

Permalink
test(app): use vi.fn over vi.spyOn for a module member mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordfirespeed committed Aug 8, 2024
1 parent df985ba commit 3b3ab19
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/core/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { InitAppAndTest } from '../../test_helpers/initAppAndTest'

vi.mock<typeof req>(import('../../packages/req/src'), async (importOriginal) => {
const module = await importOriginal()
vi.spyOn(module, 'getRequestHeader')
return module

return {
...module,
getRequestHeader: vi.fn(module.getRequestHeader)
} satisfies typeof req
})

describe('Request properties', () => {
Expand Down

0 comments on commit 3b3ab19

Please sign in to comment.