You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/5/en/part5c.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ afterEach(() => {
57
57
})
58
58
```
59
59
60
-
Now, after each test, the function _cleanup_ is performed that resets the jsdom that is simulating the browser.
60
+
Now, after each test, the function _cleanup_ is executed to reset jsdom, which is simulating the browser.
61
61
62
62
Expand the _vite.config.js_ file as follows
63
63
@@ -131,7 +131,7 @@ We can use the object [screen](https://testing-library.com/docs/queries/about#sc
131
131
expect(element).toBeDefined()
132
132
```
133
133
134
-
The existence of an element is checked using Vitest's [expect](https://vitest.dev/api/expect.html#expect) command. Expect generates an assertion from its parameter, the validity of which can be tested using various condition functions. Now we used [toBeDefined](https://vitest.dev/api/expect.html#tobedefined) which tests whether the _element_parameter of expect exists.
134
+
The existence of an element is checked using Vitest's [expect](https://vitest.dev/api/expect.html#expect) command. Expect generates an assertion for its argument, the validity of which can be tested using various condition functions. Now we used [toBeDefined](https://vitest.dev/api/expect.html#tobedefined) which tests whether the _element_argument of expect exists.
135
135
136
136
Run the test with command _npm test_:
137
137
@@ -384,7 +384,7 @@ The expectation of the test uses [toHaveLength](https://vitest.dev/api/expect.ht
384
384
expect(mockHandler.mock.calls).toHaveLength(1)
385
385
```
386
386
387
-
The calls of the mock function are saved to the array [mock.calls](https://vitest.dev/api/mock#mock-calls) within the mock function object.
387
+
The calls to the mock function are saved to the array [mock.calls](https://vitest.dev/api/mock#mock-calls) within the mock function object.
388
388
389
389
[Mock objects and functions](https://en.wikipedia.org/wiki/Mock_object) are commonly used [stub](https://en.wikipedia.org/wiki/Method_stub) components in testing that are used for replacing dependencies of the components being tested. Mocks make it possible to return hardcoded responses, and to verify the number of times the mock functions are called and with what parameters.
0 commit comments