Skip to content

Commit

Permalink
clean up tests and adds basic check for the login logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabib committed Dec 24, 2024
1 parent 5b4e2ac commit 03ab7dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion frontend/src/lib/routes/Reporting.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
);
</script>

<Island>
<Island testId="reporting-page">
<main>
<ReportingNeurons />
<Separator spacing="medium" />
Expand Down
26 changes: 10 additions & 16 deletions frontend/src/tests/routes/app/reporting/page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,19 @@ import { resetIdentity, setNoIdentity } from "$tests/mocks/auth.store.mock";
import { render } from "@testing-library/svelte";

describe("Reporting page", () => {
describe("not signed in", () => {
beforeEach(() => {
setNoIdentity();
});
it("should render sign-in if not logged in", () => {
setNoIdentity();

it("should render sign-in if not logged in", () => {
const { getByTestId } = render(ReportingPage);

expect(getByTestId("login-button")).not.toBeNull();
});
const { queryByTestId } = render(ReportingPage);
expect(queryByTestId("login-button")).not.toBeNull();
expect(queryByTestId("reporting-page")).toBeNull();
});

describe("signed in", () => {
beforeEach(() => {
resetIdentity();
});
it("should render transactions page if logged in", () => {
resetIdentity();

// TODO: Once the ExportNeurons and ExportTransactions components are migrated to this new page
it.skip("should render generate neurons report section", () => {});
it.skip("should render generate transactions report section", () => {});
const { queryByTestId } = render(ReportingPage);
expect(queryByTestId("login-button")).toBeNull();
expect(queryByTestId("reporting-page")).not.toBeNull();
});
});

0 comments on commit 03ab7dc

Please sign in to comment.