Skip to content

Commit e45ccd2

Browse files
committed
replace NoReports snapshot test with RTL
1 parent 0c1d50a commit e45ccd2

2 files changed

Lines changed: 26 additions & 39 deletions

File tree

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
1+
import React from 'react';
2+
import { render, screen } from '@testing-library/react';
3+
import '@testing-library/jest-dom';
24

35
import NoReports from './NoReports';
46

5-
const fixtures = {
6-
'should render when reports expected': {
7-
reportsExpected: true,
8-
},
9-
'should render when reports not expected': {
10-
reportsExpected: false,
11-
},
12-
};
13-
14-
describe('NoReports', () =>
15-
testComponentSnapshotsWithFixtures(NoReports, fixtures));
7+
describe('NoReports', () => {
8+
it('should render when reports expected', () => {
9+
render(<NoReports reportsExpected />);
10+
11+
expect(screen.getByText('No Preupgrade Report Available')).toBeInTheDocument();
12+
expect(
13+
screen.getByText(
14+
'The preupgrade report could not be generated, check the job details for the reason'
15+
)
16+
).toBeInTheDocument();
17+
});
18+
19+
it('should render when reports not expected', () => {
20+
render(<NoReports reportsExpected={false} />);
21+
22+
expect(screen.getByText('No Preupgrade Report Available')).toBeInTheDocument();
23+
expect(
24+
screen.getByText(
25+
'The preupgrade report will be available after the job finishes'
26+
)
27+
).toBeInTheDocument();
28+
});
29+
});

webpack/components/PreupgradeReports/components/__snapshots__/NoReports.test.js.snap

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)