Skip to content

Commit

Permalink
Add cleanup to multi-test files
Browse files Browse the repository at this point in the history
  • Loading branch information
dfcook committed Jun 1, 2019
1 parent 89b9b26 commit 6ff1d04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/__tests__/stopwatch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import StopWatch from './components/StopWatch.vue'
import { render, wait, fireEvent } from '@testing-library/vue'
import { cleanup, render, wait, fireEvent } from '@testing-library/vue'
import 'jest-dom/extend-expect'

afterEach(cleanup)

test('unmounts a component', async () => {
jest.spyOn(console, 'error').mockImplementation(() => {})

Expand Down
4 changes: 3 additions & 1 deletion tests/__tests__/vue-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import App from './components/Router/App.vue'
import Home from './components/Router/Home.vue'
import About from './components/Router/About.vue'

import { render, fireEvent } from '@testing-library/vue'
import { cleanup, render, fireEvent } from '@testing-library/vue'

const routes = [
{ path: '/', component: Home },
{ path: '/about', component: About },
{ path: '*', redirect: '/about' }
]

afterEach(cleanup)

test('full app rendering/navigating', async () => {
const { queryByTestId } = render(App, { routes })

Expand Down
4 changes: 3 additions & 1 deletion tests/__tests__/vuex.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'jest-dom/extend-expect'

import VuexTest from './components/VuexTest'
import { render, fireEvent } from '@testing-library/vue'
import { cleanup, render, fireEvent } from '@testing-library/vue'

afterEach(cleanup)

const store = {
state: {
Expand Down

0 comments on commit 6ff1d04

Please sign in to comment.