Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advisory details fixes #2873

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/js/pages/AdvisoryDetails/AdvisoryDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ function AdvisoryDetails({
<li key={`bug-${id}`}>
<a
className="text-jungle-green-500 hover:opacity-75"
target="_blank"
rel="noreferrer"
href={`https://bugzilla.suse.com/show_bug.cgi?id=${id}`}
>
{fix}
Expand All @@ -110,6 +112,8 @@ function AdvisoryDetails({
<li key={cve}>
<a
className="text-jungle-green-500 hover:opacity-75"
target="_blank"
rel="noreferrer"
href={`https://cve.mitre.org/cgi-bin/cvename.cgi?name=${cve}`}
>
{cve}
Expand Down
4 changes: 3 additions & 1 deletion assets/js/pages/AdvisoryDetails/AdvisoryDetailsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ function AdvisoryDetailsPage() {
return (
<>
<BackButton url={`/hosts/${hostID}`}>Back</BackButton>
{!isLoading ? <AdvisoryDetails errata={advisoryErrata} /> : null}
{!isLoading ? (
<AdvisoryDetails advisoryName={advisoryID} errata={advisoryErrata} />
) : null}
</>
);
}
Expand Down
44 changes: 44 additions & 0 deletions assets/js/pages/AdvisoryDetails/AdvisoryDetailsPage.test.jsx
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();
});
});
Loading