Skip to content

Commit dae56db

Browse files
committed
03/02: add test renaming to tasks
1 parent f3274c6 commit dae56db

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

exercises/03.best-practices/02.problem.user-events/src/discount-code-form.browser.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { page } from '@vitest/browser/context'
22
import { render } from 'vitest-browser-react'
33
import { DiscountCodeForm } from './discount-code-form.js'
44

5+
// 🐨 Rename this test name to reflect the changes
6+
// you are about to make.
7+
// 💰 "applies a discount code"
58
test('renders the discount form', async () => {
69
render(<DiscountCodeForm />)
710

exercises/03.best-practices/02.solution.user-events/README.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ In its current state, our discount form component test gives you some value, but
44

55
The main purpose of the discount form component is to apply the given discount code. _That_ is what has to be reflected in automated tests.
66

7-
In the `discount-code-form.browser.test.tsx`, I will start by renaming the test case to reflect what I am testing here.
7+
First, I will rename the test case name to reflect the changes I'm about to make:
8+
9+
```ts filename=discount-code-form.browser.test.tsx remove=1 add=2
10+
test('renders the discount form', async () => {
11+
test('applies a discount code', async () => {
12+
```
13+
14+
> 🦉 Check out the [How to write better test names](https://www.epicweb.dev/talks/how-to-write-better-test-names) talk to learn about 5 tips for stellar test names.
15+
16+
Next, in the `discount-code-form.browser.test.tsx`, I will start by renaming the test case to reflect what I am testing here.
817
918
```tsx filename=discount-code-form.browser.test.tsx remove=1 add=2 nocopy
1019
test('renders the discount form', async () => {

0 commit comments

Comments
 (0)