Skip to content

Commit 2c5d192

Browse files
author
Paul
authored
docs: use same pattern in examples (#5051)
1 parent 0d2bfea commit 2c5d192

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/guide/mocking.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ import * as mod from './foobar.js'
228228
vi.spyOn(mod, 'foo')
229229
vi.mock('./foobar.js', async (importOriginal) => {
230230
return {
231-
...await importOriginal(),
231+
...await importOriginal<typeof import('./foobar.js')>(),
232232
// this will only affect "foo" outside of the original module
233233
foo: () => 'mocked'
234234
}
@@ -609,8 +609,8 @@ expect(obj.method).toHaveBeenCalled()
609609
```ts
610610
import { mocked, original } from './some-path.js'
611611

612-
vi.mock('./some-path.js', async () => {
613-
const mod = await vi.importActual<typeof import('./some-path.js')>('./some-path.js')
612+
vi.mock('./some-path.js', async (importOriginal) => {
613+
const mod = await importOriginal<typeof import('./some-path.js')>()
614614
return {
615615
...mod,
616616
mocked: vi.fn()

0 commit comments

Comments
 (0)