Skip to content

Commit 9980ece

Browse files
authored
fix(blog): fix typo in vitest-when article
1 parent f57a716 commit 9980ece

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pages/articles/2023-06-30-better-stubs.page.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export const metadata = {
22
title: 'Better mocks in Vitest',
33
description: 'Introducing vitest-when: better mocking in Vitest',
44
posted: '2023-06-30',
5+
updated: '2023-08-04',
56
}
67

78
Mocking is a fantastic tool for writing high-quality unit tests, but **nothing
@@ -52,7 +53,7 @@ test('stub something', () => {
5253
In the above example, the `sayHello` stub behaves accordingly:
5354

5455
- When `sayHello` is called with `Alice`, it will return `Hello, Alice`
55-
- When `sayHello` is called with `Box`, it will return `Hey, Bob`
56+
- When `sayHello` is called with `Bob`, it will return `Hey, Bob`
5657
- When `sayHello` is called in any other way, it will return `undefined`
5758

5859
Stubs are useful when you're mocking a function that returns data. You set up a
@@ -208,7 +209,7 @@ expect(sayHello).toHaveBeenCalledWith('Alice') // assert cause
208209

209210
The argument assertion lives after, and away from, the return value, making the
210211
test harder to read and maintain compared to vitest-when's strategy of
211-
configuring a cause and effect.
212+
configuring a cause and effect at the same time.
212213

213214
You also perform an _assertion_ to check the arguments, which is a more forceful
214215
check that vitest-when's "filter by arguments and no-op otherwise" strategy.

0 commit comments

Comments
 (0)