-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Open bugzilla links and cves in new tabs * Add render test to AdvisoryDetailsPage
- Loading branch information
1 parent
b9972ab
commit 69ff1ea
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
44 changes: 44 additions & 0 deletions
44
assets/js/pages/AdvisoryDetails/AdvisoryDetailsPage.test.jsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { screen, act } from '@testing-library/react'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
import { networkClient } from '@lib/network'; | ||
import '@testing-library/jest-dom'; | ||
|
||
import { faker } from '@faker-js/faker'; | ||
|
||
import { | ||
renderWithRouterMatch, | ||
defaultInitialState, | ||
withState, | ||
} from '@lib/test-utils'; | ||
import { advisoryErrataFactory } from '@lib/test-utils/factories'; | ||
|
||
import AdvisoryDetailsPage from '.'; | ||
|
||
describe('Advisory Details Page', () => { | ||
it('should render correctly', async () => { | ||
const axiosMock = new MockAdapter(networkClient); | ||
|
||
const hostID = faker.string.uuid(); | ||
const advisoryName = faker.string.uuid(); | ||
const errata = advisoryErrataFactory.build(); | ||
|
||
axiosMock | ||
.onGet(`/api/v1/software_updates/errata_details/${advisoryName}`) | ||
.reply(200, errata); | ||
|
||
const [StatefulPage] = withState( | ||
<AdvisoryDetailsPage />, | ||
defaultInitialState | ||
); | ||
|
||
await act(async () => { | ||
renderWithRouterMatch(StatefulPage, { | ||
path: 'hosts/:hostID/patches/:advisoryID', | ||
route: `/hosts/${hostID}/patches/${advisoryName}`, | ||
}); | ||
}); | ||
|
||
expect(screen.getByText(advisoryName)).toBeVisible(); | ||
}); | ||
}); |