@@ -127,22 +127,29 @@ for best practices while writing your Vue components and templates.
## Testing Vue Components
Each Vue component has a unique output. This output is always present in the render function.
Although we can test each method of a Vue component individually, our goal must be to test the rendered output.
What a component renders represents the state at all times, and we should be able to change method & computed prop internals without causing tests to fail.
Although we can test each method of a Vue component individually, our goal must be to test the output
of the render/template function, which represents the state at all times.
For testing Vue components, we use [Vue Test Utils][vue-test-utils]. To mock network requests, use [axios mock adapter](axios.md#mock-axios-response-on-tests). For general Vue unit testing notes, see the [Vue Test Docs][vue-test].
Make use of the [axios mock adapter](axios.md#mock-axios-response-on-tests) to mock data returned.
Here's how we would test the Todo App above:
### Mounting Components
Vue Test Utils provides the `mount` method, which returns a [Wrapper][vue-test-utils-wrapper].
For complex components, using `shallowMount` stubs child components. This means tests
can run faster, and we aren't testing with DOM structure of children.