Skip to content

Instantly share code, notes, and snippets.

@rodrigograca31
Created June 7, 2020 18:55
Show Gist options
  • Save rodrigograca31/f8b46d78defb696490b9f028f6bc015f to your computer and use it in GitHub Desktop.
Save rodrigograca31/f8b46d78defb696490b9f028f6bc015f to your computer and use it in GitHub Desktop.
React testing with redux
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();
// });
});
/home/unknown/git/lambda/Labs/lambda-door-client/src/pages/Company
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