Skip to content

Commit 636ee5b

Browse files
vuejs-jp-botre-fort
authored andcommitted
docs: fix formatting (#767)
1 parent ba07f1b commit 636ee5b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/v2/cookbook/unit-testing-vue-components.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ Component unit tests have lots of benefits:
7979
- Improve design
8080
- Facilitate refactoring
8181

82-
Automated testing allows large teams of developers to maintain complex codebases.
82+
Automated testing allows large teams of developers to maintain complex codebases.
8383

8484
#### Getting started
8585

86-
[vue-test-utils](https://github.com/vuejs/vue-test-utils) is the official library for unit testing Vue components. The (vue-cli)[https://github.com/vuejs/vue-cli] webpack template comes with either Karma or Jest, both well supported test runners, and there are some (guides)[https://vue-test-utils.vuejs.org/en/guides/] in the `vue-test-utils` documentation.
86+
[vue-test-utils](https://github.com/vuejs/vue-test-utils) is the official library for unit testing Vue components. The [vue-cli](https://github.com/vuejs/vue-cli) webpack template comes with either Karma or Jest, both well supported test runners, and there are some [guides](https://vue-test-utils.vuejs.org/en/guides/) in the `vue-test-utils` documentation.
8787

8888
## Real-World Example
8989

@@ -92,11 +92,11 @@ Unit tests should be
9292
- Easy to understand
9393
- Only test a _single unit of work_
9494

95-
Let's continue building on the previous example, while introducing the idea of a [factory function](https://en.wikipedia.org/wiki/Factory_(object-oriented_programming)) to make our test more compact and readable. The component should:
95+
Let's continue building on the previous example, while introducing the idea of a <a href="https://en.wikipedia.org/wiki/Factory_(object-oriented_programming)">factory function</a> to make our test more compact and readable. The component should:
9696

9797
- show a 'Welcome to the Vue.js cookbook' greeting.
9898
- prompt the user to enter their username
99-
- if the entered username is less than seven letters, display an error
99+
- display an error if the entered username is less than seven letters
100100

101101
Let's take a look at the component code first:
102102

@@ -218,7 +218,7 @@ describe('Foo', () => {
218218

219219
Points to note:
220220

221-
At the top, we declare the factory function which merges the `values` object into `data` and returns a new `wrapper` instance. This way, we don't need to duplicate `const wrapper = shallow(Foo)` in every test. Another great benefit to this is when more complex components with a method or computed property you might want to mock or stub in every test, you only need to declare it once.
221+
At the top, we declare the factory function which merges the `values` object into `data` and returns a new `wrapper` instance. This way, we don't need to duplicate `const wrapper = shallow(Foo)` in every test. Another great benefit to this is when more complex components with a method or computed property you might want to mock or stub in every test, you only need to declare it once.
222222

223223
## Additional Context
224224

@@ -230,13 +230,13 @@ Thee above test is fairly simple, but in practise Vue components often have othe
230230

231231
There are more complete examples showing such tests in the `vue-test-utils` [guides](https://vue-test-utils.vuejs.org/en/guides/).
232232

233-
`vue-test-utils` and the enormous JavaScript ecosystem provides plenty of tooling to facilitate almost 100% test coverage. Unit tests are only one part of the testing pyramid, though. Some other types of tests include e2e (end to end) tests, and snapshot tests. Unit tests are the smallest and most simple of tests - they make assertions on the smallest units of work, isolating each part of a single component.
233+
`vue-test-utils` and the enormous JavaScript ecosystem provides plenty of tooling to facilitate almost 100% test coverage. Unit tests are only one part of the testing pyramid, though. Some other types of tests include e2e (end to end) tests, and snapshot tests. Unit tests are the smallest and most simple of tests - they make assertions on the smallest units of work, isolating each part of a single component.
234234

235235
Snapshot tests save the markup of your Vue component, and compare to the new one generated each time the test runs. If something changes, the developer is notified, and can decide if the change was intentional (the component was updated) or accidentally (the component is behaving incorrectly).
236236

237237
End to end tests involve ensure a number of components interact together well. They are more high level. Some examples might be testing if a user can sign up, log in, and update their username. These are slowly to run than unit tests or snapshot tests.
238238

239-
Unit tests are most useful during development, either to help a developer think about how to design a component, or refactor an existing component, and are often run every time code is changed.
239+
Unit tests are most useful during development, either to help a developer think about how to design a component, or refactor an existing component, and are often run every time code is changed.
240240

241241
Higher level tests, such as end to end tests, run much slower. These usually run pre-deploy, to ensure each part of the system is working together correctly.
242242

0 commit comments

Comments
 (0)