Created
June 7, 2020 18:55
-
-
Save rodrigograca31/f8b46d78defb696490b9f028f6bc015f to your computer and use it in GitHub Desktop.
React testing with redux
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
describe('CompanyPage', () => { | |
it('renders correctly', () => { | |
expect( | |
renderWithProviders( | |
withRouter( | |
<CompanyPage companies={testCompanies} avgSalaries={testSalaries} /> | |
) | |
).baseElement | |
).toMatchSnapshot(); | |
}); | |
// it('renders the tab names correctly', () => { | |
// const { getByText } = renderWithProviders( | |
// withRouter( | |
// <CompanyPage companies={testCompanies} avgSalaries={testSalaries} /> | |
// ) | |
// ); | |
// const tab1 = getByText(/company info/i); | |
// const tab2 = getByText(/company reviews/i); | |
// const tab3 = getByText(/salary reviews/i); | |
// const tab4 = getByText(/interview process reviews/i); | |
// expect(tab1).toBeVisible(); | |
// expect(tab2).toBeVisible(); | |
// expect(tab3).toBeVisible(); | |
// expect(tab4).toBeVisible(); | |
// }); | |
}); |
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
/home/unknown/git/lambda/Labs/lambda-door-client/src/pages/Company |
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 * as rtl from '@testing-library/react'; | |
import { Provider } from 'react-redux'; | |
import store from '../../state/store.js'; | |
const renderWithProviders = ui => { | |
return { | |
...rtl.render(<Provider store={store}>{ui}</Provider>), | |
}; | |
}; | |
export default renderWithProviders; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment