plugins: rtl 13 fixes for tests
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -34,8 +34,12 @@ const apis = TestApiRegistry.from(
|
||||
);
|
||||
|
||||
describe('Incidents', () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('Renders an empty state when there are no incidents', async () => {
|
||||
@@ -47,13 +51,10 @@ describe('Incidents', () => {
|
||||
<Incidents readOnly={false} refreshIncidents={false} team="test" />
|
||||
</ApiProvider>,
|
||||
);
|
||||
await waitFor(() => !screen.queryByTestId('progress'));
|
||||
await waitFor(
|
||||
() =>
|
||||
expect(
|
||||
screen.getByText('Nice! No incidents found!'),
|
||||
).toBeInTheDocument(),
|
||||
{ timeout: 2000 },
|
||||
jest.advanceTimersByTime(2000);
|
||||
await waitFor(() => expect(screen.queryByTestId('progress')).toBe(null));
|
||||
await waitFor(() =>
|
||||
expect(screen.getByText('Nice! No incidents found!')).toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -66,15 +67,14 @@ describe('Incidents', () => {
|
||||
<Incidents readOnly={false} team="test" refreshIncidents={false} />
|
||||
</ApiProvider>,
|
||||
);
|
||||
await waitFor(() => !screen.queryByTestId('progress'));
|
||||
await waitFor(
|
||||
() =>
|
||||
expect(
|
||||
screen.getByText('user', {
|
||||
exact: false,
|
||||
}),
|
||||
).toBeInTheDocument(),
|
||||
{ timeout: 2000 },
|
||||
jest.advanceTimersByTime(2000);
|
||||
await waitFor(() => expect(screen.queryByTestId('progress')).toBe(null));
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.getByText('user', {
|
||||
exact: false,
|
||||
}),
|
||||
).toBeInTheDocument(),
|
||||
);
|
||||
expect(screen.getByText('test-incident')).toBeInTheDocument();
|
||||
expect(screen.getByTitle('Acknowledged')).toBeInTheDocument();
|
||||
@@ -93,15 +93,14 @@ describe('Incidents', () => {
|
||||
<Incidents readOnly team="test" refreshIncidents={false} />
|
||||
</ApiProvider>,
|
||||
);
|
||||
await waitFor(() => !screen.queryByTestId('progress'));
|
||||
await waitFor(
|
||||
() =>
|
||||
expect(
|
||||
screen.getByText('user', {
|
||||
exact: false,
|
||||
}),
|
||||
).toBeInTheDocument(),
|
||||
{ timeout: 2000 },
|
||||
jest.advanceTimersByTime(2000);
|
||||
await waitFor(() => expect(screen.queryByTestId('progress')).toBe(null));
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.getByText('user', {
|
||||
exact: false,
|
||||
}),
|
||||
).toBeInTheDocument(),
|
||||
);
|
||||
expect(screen.getByText('test-incident')).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Status warning')).toBeInTheDocument();
|
||||
@@ -127,15 +126,14 @@ describe('Incidents', () => {
|
||||
<Incidents readOnly={false} team="test" refreshIncidents={false} />
|
||||
</ApiProvider>,
|
||||
);
|
||||
await waitFor(() => !screen.queryByTestId('progress'));
|
||||
await waitFor(
|
||||
() =>
|
||||
expect(
|
||||
screen.getByText(
|
||||
'Error encountered while fetching information. Error occurred',
|
||||
),
|
||||
).toBeInTheDocument(),
|
||||
{ timeout: 2000 },
|
||||
jest.advanceTimersByTime(2000);
|
||||
await waitFor(() => expect(screen.queryByTestId('progress')).toBe(null));
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.getByText(
|
||||
'Error encountered while fetching information. Error occurred',
|
||||
),
|
||||
).toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user