Updated unit tests for the new UI

This commit is contained in:
Gustaf Räntilä
2021-02-17 13:40:36 +01:00
parent db6ff2daa2
commit 1743239d03
2 changed files with 6 additions and 11 deletions
@@ -79,6 +79,7 @@ export const IncidentListItem = ({ incident }: Props) => {
primary={
<>
<Chip
data-testid={`chip-${incident.status}`}
label={incident.status}
size="small"
variant="outlined"
@@ -84,13 +84,7 @@ describe('Incidents', () => {
},
] as Incident[],
);
const {
getByText,
getByTitle,
getAllByTitle,
getByLabelText,
queryByTestId,
} = render(
const { getByText, getAllByTitle, queryByTestId } = render(
wrapInTestApp(
<ApiProvider apis={apis}>
<Incidents serviceId="abc" refreshIncidents={false} />
@@ -102,10 +96,10 @@ describe('Incidents', () => {
expect(getByText('title2')).toBeInTheDocument();
expect(getByText('person1')).toBeInTheDocument();
expect(getByText('person2')).toBeInTheDocument();
expect(getByTitle('triggered')).toBeInTheDocument();
expect(getByTitle('acknowledged')).toBeInTheDocument();
expect(getByLabelText('Status error')).toBeInTheDocument();
expect(getByLabelText('Status warning')).toBeInTheDocument();
expect(getByText('triggered')).toBeInTheDocument();
expect(getByText('acknowledged')).toBeInTheDocument();
expect(queryByTestId('chip-triggered')).toBeInTheDocument();
expect(queryByTestId('chip-acknowledged')).toBeInTheDocument();
// assert links, mailto and hrefs, date calculation
expect(getAllByTitle('View in PagerDuty').length).toEqual(2);