Created
July 2, 2020 00:26
-
-
Save eternal44/350fd02baf493dc894f16f15c3748329 to your computer and use it in GitHub Desktop.
jest test example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render } from '@testing-library/react' | |
import '@testing-library/jest-dom/extend-expect' | |
import ERshow from '../components/ERshow' | |
import { | |
offer, | |
YetAnotherMUAprofileShow, | |
MUAoffer, | |
exchangeRequest, | |
} from './__mocks__/resources' | |
jest.mock('axios') | |
describe('ERshow', () => { | |
describe('renders without errors', () => { | |
test('renders the page correctly', () => { | |
const { getByText, queryByText } = render( | |
<ERshow | |
exchangeRequest={exchangeRequest} | |
requestingOffer={offer} | |
respondingOffer={MUAoffer} | |
respondingProfile={YetAnotherMUAprofileShow} | |
/> | |
) | |
expect(getByText(/Job start and end/i)).toBeInTheDocument() | |
expect(getByText(/match score/i)).toBeInTheDocument() | |
expect(queryByText(/your availability/i)).toBeNull() | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment