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
docs(testing): remove example using mock with inject-loader because it no longer works and causes confusion for beginners. Use the existing spy implementation instead.
Copy file name to clipboardExpand all lines: docs/guide/testing.md
+2-61Lines changed: 2 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,9 @@ describe('mutations', () => {
51
51
52
52
## Testing Actions
53
53
54
-
Actions can be a bit more tricky because they may call out to external APIs. When testing actions, we usually need to do some level of mocking - for example, we can abstract the API calls into a service and mock that service inside our tests. In order to easily mock dependencies, we can use webpack and [inject-loader](https://github.com/plasticine/inject-loader) to bundle our test files.
54
+
Actions can be a bit more tricky because they may call out to external APIs. When testing actions, we usually need to do some level of mocking and spying - for example, we can abstract the API calls into a service and mock that service inside our tests.
55
55
56
-
Example testing an async action:
56
+
The following code assumes your testing environment uses [Sinon.JS](http://sinonjs.org/):
If you have spies available in your testing environment (for example via [Sinon.JS](http://sinonjs.org/)), you can use them instead of the `testAction` helper:
0 commit comments