Skip to content

Commit

Permalink
docs: use same pattern in examples (#5051)
Browse files Browse the repository at this point in the history
  • Loading branch information
akellbl4 committed Jan 30, 2024
1 parent 0d2bfea commit 2c5d192
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/guide/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ import * as mod from './foobar.js'
vi.spyOn(mod, 'foo')
vi.mock('./foobar.js', async (importOriginal) => {
return {
...await importOriginal(),
...await importOriginal<typeof import('./foobar.js')>(),
// this will only affect "foo" outside of the original module
foo: () => 'mocked'
}
Expand Down Expand Up @@ -609,8 +609,8 @@ expect(obj.method).toHaveBeenCalled()
```ts
import { mocked, original } from './some-path.js'

vi.mock('./some-path.js', async () => {
const mod = await vi.importActual<typeof import('./some-path.js')>('./some-path.js')
vi.mock('./some-path.js', async (importOriginal) => {
const mod = await importOriginal<typeof import('./some-path.js')>()
return {
...mod,
mocked: vi.fn()
Expand Down

0 comments on commit 2c5d192

Please sign in to comment.