Skip to content

Commit 14a24cc

Browse files
authored
docs: fix typos in README
1 parent 544710e commit 14a24cc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ test('stubbing with vitest-when', () => {
5151
when(stub).calledWith(1, 2, 3).thenReturn(4);
5252
when(stub).calledWith(4, 5, 6).thenReturn(7);
5353

54-
const result123 = stub(1, 2, 3);
54+
let result = stub(1, 2, 3);
5555
expect(result).toBe(4);
5656

57-
const result456 = stub(4, 5, 6);
57+
result = stub(4, 5, 6);
5858
expect(result).toBe(7);
5959

60-
const result789 = stub(7, 8, 9);
60+
result = stub(7, 8, 9);
6161
expect(result).toBe(undefined);
6262
});
6363
```
@@ -190,7 +190,8 @@ import { vi } from 'vitest';
190190
import { when } from 'vitest-when';
191191

192192
const spy = vi.fn();
193-
const stubWrapper = when(spy);
193+
194+
when(spy);
194195

195196
expect(spy()).toBe(undefined);
196197
```
@@ -201,7 +202,8 @@ Create a stub that matches a given set of arguments which you can configure with
201202

202203
```ts
203204
const spy = vi.fn();
204-
const stub = when(spy).calledWith('hello').thenReturn('world');
205+
206+
when(spy).calledWith('hello').thenReturn('world');
205207

206208
expect(spy('hello')).toEqual('world');
207209
```
@@ -220,10 +222,10 @@ expect(spy('anything')).toEqual('world');
220222
If `calledWith` is used multiple times, the last configured stubbing will be used.
221223

222224
```ts
223-
when(spy).calledWith("hello").thenReturn("world")
224-
expect(spy("hello")).toEqual("world")
225-
when(spy).calledWith("hello").thenReturn("goodbye"
226-
expect(spy("hello")).toEqual("goodbye")
225+
when(spy).calledWith('hello').thenReturn('world');
226+
expect(spy('hello')).toEqual('world');
227+
when(spy).calledWith('hello').thenReturn('goodbye');
228+
expect(spy('hello')).toEqual('goodbye');
227229
```
228230

229231
[asymmetric matchers]: https://vitest.dev/api/expect.html#expect-anything

0 commit comments

Comments
 (0)