Skip to content

Commit

Permalink
Updated header tests/snapshots to reflect removed Nav items
Browse files Browse the repository at this point in the history
  • Loading branch information
chrtorres committed Mar 19, 2024
1 parent 3c6ddf1 commit aa58966
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Header component matches snapshot 1`] = `
<DocumentFragment>
<div
class="css-1ww9ebi"
class="css-ckkwiw"
>
<header
class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation0 MuiAppBar-root MuiAppBar-colorPrimary MuiAppBar-positionStatic css-1twrj82-MuiPaper-root-MuiAppBar-root"
Expand All @@ -27,7 +27,7 @@ exports[`Header component matches snapshot 1`] = `
class="Header-lgNav"
>
<div
class="css-g2ra7n"
class="css-1ssxti9"
>
<a
aria-current="page"
Expand All @@ -39,7 +39,7 @@ exports[`Header component matches snapshot 1`] = `
</a>
</div>
<div
class="css-g2ra7n"
class="css-1ssxti9"
>
<a
class="NavItem-link"
Expand Down Expand Up @@ -79,44 +79,6 @@ exports[`Header component matches snapshot 1`] = `
</form>
</div>
</div>
<div
class="css-g2ra7n"
>
<a
aria-current="page"
class="NavItem-link NavItem-link"
href="/"
style="outline: none;"
>
<div
class="Header-userLink"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
data-testid="AccountCircleIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 4c1.93 0 3.5 1.57 3.5 3.5S13.93 13 12 13s-3.5-1.57-3.5-3.5S10.07 6 12 6zm0 14c-2.03 0-4.43-.82-6.14-2.88C7.55 15.8 9.68 15 12 15s4.45.8 6.14 2.12C16.43 19.18 14.03 20 12 20z"
/>
</svg>
My Account
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
data-testid="ArrowDropDownIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="m7 10 5 5 5-5z"
/>
</svg>
</div>
</a>
</div>
<button
aria-label="toggle mobile menu"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-edgeStart MuiIconButton-sizeMedium Header-menuButton css-1d6w9lk-MuiButtonBase-root-MuiIconButton-root"
Expand Down
50 changes: 8 additions & 42 deletions frontend/src/components/__tests__/header.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ describe('Header component', () => {
currentOrganization: { ...testOrganization }
}
});
[
'Vulnerabilities',
'Risk Summary',
// 'My Organizations',
'Manage Organizations',
'Scans',
'Manage Users',
'My Account'
].forEach((expected) => {
['Vulnerabilities', 'Risk Summary', 'Scans'].forEach((expected) => {
expect(queryByText(expected)).not.toBeInTheDocument();
});
});
Expand All @@ -50,17 +42,10 @@ describe('Header component', () => {
currentOrganization: { ...testOrganization }
}
});
[
'Overview',
'Inventory',
// 'My Organizations',
'My Account',
'My Settings',
'Logout'
].forEach((expected) => {
['Overview', 'Inventory'].forEach((expected) => {
expect(getByText(expected)).toBeInTheDocument();
});
['Manage Organizations', 'Scans', 'Manage Users'].forEach((notExpected) => {
['Scans'].forEach((notExpected) => {
expect(queryByText(notExpected)).not.toBeInTheDocument();
});
});
Expand All @@ -72,19 +57,12 @@ describe('Header component', () => {
currentOrganization: { ...testOrganization }
}
});
[
'Overview',
'Inventory',
// 'My Organizations',
'My Account',
'My Settings',
'Logout'
].forEach((expected) => {
['Overview', 'Inventory'].forEach((expected) => {
expect(getByText(expected)).toBeInTheDocument();
});
['Manage Organizations', 'Manage Users'].forEach((notExpected) => {
expect(queryByText(notExpected)).not.toBeInTheDocument();
});
// ['Manage Organizations', 'Manage Users'].forEach((notExpected) => {
// expect(queryByText(notExpected)).not.toBeInTheDocument();
// });
});

it('shows correct links for GLOBAL_ADMIN', () => {
Expand All @@ -94,20 +72,8 @@ describe('Header component', () => {
currentOrganization: { ...testOrganization }
}
});
[
'Overview',
'Inventory',
'Scans',
'Manage Organizations',
'Manage Users',
'My Account',
'My Settings',
'Logout'
].forEach((expected) => {
['Overview', 'Inventory', 'Scans'].forEach((expected) => {
expect(getByText(expected)).toBeInTheDocument();
});
// ['My Organizations'].forEach((notExpected) => {
// expect(queryByText(notExpected)).not.toBeInTheDocument();
// });
});
});

0 comments on commit aa58966

Please sign in to comment.