Skip to content

Commit

Permalink
Update frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ameliav committed Mar 26, 2024
1 parent 239bbea commit 24abfec
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 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-1octzoq"
class="css-2vyz2w"
>
<header
class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation0 MuiAppBar-root MuiAppBar-colorPrimary MuiAppBar-positionStatic css-1twrj82-MuiPaper-root-MuiAppBar-root"
Expand Down Expand Up @@ -79,27 +79,44 @@ exports[`Header component matches snapshot 1`] = `
</form>
</div>
</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"
tabindex="0"
type="button"
<div
class="css-1ssxti9"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
data-testid="MenuIcon"
focusable="false"
viewBox="0 0 24 24"
<a
aria-current="page"
class="NavItem-link NavItem-link"
href="/"
style="outline: none;"
>
<path
d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"
/>
</svg>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
<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>
</div>
</div>
</header>
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/components/__tests__/header.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ describe('Header component', () => {
});

it('can expand drawer', async () => {
const { getByLabelText, getByTestId, queryByTestId } = render(<Header />);
const { queryByTestId } = render(<Header />);
expect(queryByTestId('mobilenav')).not.toBeInTheDocument();
expect(getByLabelText('toggle mobile menu')).toBeInTheDocument();
fireEvent.click(getByLabelText('toggle mobile menu'));
await waitFor(() => {
expect(getByTestId('mobilenav')).toBeInTheDocument();
});
});

it('shows no links for unauthenticated user', () => {
Expand Down

0 comments on commit 24abfec

Please sign in to comment.