Skip to content

Instantly share code, notes, and snippets.

@the-teacher
Created April 30, 2019 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-teacher/50dbf1f7aaf7367e7179bab3d7efd26f to your computer and use it in GitHub Desktop.
Save the-teacher/50dbf1f7aaf7367e7179bab3d7efd26f to your computer and use it in GitHub Desktop.
import React from 'react'
import 'jest-dom/extend-expect'
import { render, cleanup } from 'react-testing-library'
import TestingRouter from './TestingRouter'
import Task from './Task'
afterEach(cleanup)
describe('Check that redirection works', () => {
it('has to redirect', () => {
const redirectUrl = '/tasks'
const data = { status: 'closed' }
const { container } = render(
<TestingRouter
ComponentWithRedirection={() => <Task data={data} />}
RedirectUrl={redirectUrl}
/>
)
expect(container.innerHTML).toEqual(
expect.stringContaining(redirectUrl)
)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment