Skip to content

Commit 9e11964

Browse files
chore(test): Rename test files for easier reference to their components (#217)
1 parent 40caa97 commit 9e11964

12 files changed

+25
-14
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/__tests__/user-event.js renamed to src/__tests__/form-user-event.js

-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import '@testing-library/jest-dom'
22
import {render, waitFor} from '@testing-library/vue'
33
import userEvent from '@testing-library/user-event'
44
import Form from './components/Form'
5-
import Select from './components/Select'
65

76
beforeEach(() => {
87
jest.spyOn(console, 'warn').mockImplementation(() => {})
@@ -57,16 +56,3 @@ test('User events in a form', async () => {
5756

5857
expect(console.warn).not.toHaveBeenCalled()
5958
})
60-
61-
test('selecting option with user events', () => {
62-
const {getByDisplayValue} = render(Select)
63-
const select = getByDisplayValue('Tyrannosaurus')
64-
expect(select.value).toBe('dino1')
65-
66-
userEvent.selectOptions(select, 'dino2')
67-
expect(select.value).toBe('dino2')
68-
69-
userEvent.selectOptions(select, 'dino3')
70-
expect(select.value).not.toBe('dino2')
71-
expect(select.value).toBe('dino3')
72-
})
File renamed without changes.
File renamed without changes.

src/__tests__/select-user-event.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import '@testing-library/jest-dom'
2+
import {render} from '@testing-library/vue'
3+
import userEvent from '@testing-library/user-event'
4+
import Select from './components/Select'
5+
6+
beforeEach(() => {
7+
jest.spyOn(console, 'warn').mockImplementation(() => {})
8+
})
9+
10+
afterEach(() => {
11+
console.warn.mockRestore()
12+
})
13+
14+
test('selecting option with user events', () => {
15+
const {getByDisplayValue} = render(Select)
16+
const select = getByDisplayValue('Tyrannosaurus')
17+
expect(select.value).toBe('dino1')
18+
19+
userEvent.selectOptions(select, 'dino2')
20+
expect(select.value).toBe('dino2')
21+
22+
userEvent.selectOptions(select, 'dino3')
23+
expect(select.value).not.toBe('dino2')
24+
expect(select.value).toBe('dino3')
25+
})
File renamed without changes.

0 commit comments

Comments
 (0)