← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~jonesogolo/maas-site-manager:1570-fix-login-navbar into maas-site-manager:main

 


Diff comments:

> diff --git a/frontend/src/components/Navigation/Navigation.test.tsx b/frontend/src/components/Navigation/Navigation.test.tsx
> index e0609fc..a5715e2 100644
> --- a/frontend/src/components/Navigation/Navigation.test.tsx
> +++ b/frontend/src/components/Navigation/Navigation.test.tsx
> @@ -83,10 +83,42 @@ describe("Navigation", () => {
>  
>      rerender(
>        <MemoryRouter initialEntries={[{ pathname: "/", key: "testKey" }]}>
> -        <Navigation />
> +        <Navigation isLoggedIn />
>        </MemoryRouter>,
>      );
>  
>      expect(primaryNavigation).toHaveClass("is-pinned");
>    });
> +
> +  it("does not display collapsible button when user is logged out", () => {
> +    render(
> +      <MemoryRouter initialEntries={[{ pathname: "/login", key: "testKey" }]}>
> +        <Navigation isLoggedIn={false} />
> +      </MemoryRouter>,
> +    );
> +
> +    expect(screen.queryByRole("button", { name: /expand main navigation/i })).not.toBeInTheDocument();
> +  });
> +
> +  it("does not display in-app navigation links when logged out", () => {
> +    render(

Could you use the renderWithMemoryRouter util instead, please.

> +      <MemoryRouter initialEntries={[{ pathname: "/", key: "testKey" }]}>
> +        <Navigation isLoggedIn={false} />
> +      </MemoryRouter>,
> +    );
> +
> +    navItems.map(({ label }) =>
> +      expect(screen.queryByRole("link", { name: new RegExp(label, "i") })).not.toBeInTheDocument(),
> +    );
> +  });
> +
> +  it("should not be collapsed when user is logged out", () => {
> +    render(
> +      <MemoryRouter initialEntries={[{ pathname: "/", key: "testKey" }]}>
> +        <Navigation isLoggedIn={false} />
> +      </MemoryRouter>,
> +    );
> +
> +    expect(screen.getByRole("navigation")).toHaveClass("is-pinned");
> +  });
>  });


-- 
https://code.launchpad.net/~jonesogolo/maas-site-manager/+git/maas-site-manager/+merge/441453
Your team MAAS Committers is requested to review the proposed merge of ~jonesogolo/maas-site-manager:1570-fix-login-navbar into maas-site-manager:main.