Skip to content

Commit

Permalink
[web] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Nov 3, 2023
1 parent 567551e commit 5cca4da
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions web/src/components/core/IssuesLink.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ import { installerRender, withNotificationProvider } from "~/test-utils";
import { createClient } from "~/client";
import { IssuesLink } from "~/components/core";

let hasIssues = false;
let mockIssues = {};

jest.mock("~/client");

beforeEach(() => {
createClient.mockImplementation(() => {
return {
issues: {
any: () => Promise.resolve(hasIssues),
onIssuesChange: jest.fn()
}
issues: jest.fn().mockResolvedValue(mockIssues),
onIssuesChange: jest.fn()
};
});
});
Expand All @@ -48,7 +46,9 @@ it("renders a link for navigating to the issues page", async () => {

describe("if there are issues", () => {
beforeEach(() => {
hasIssues = true;
mockIssues = {
storage: [{ description: "issue 1" }]
};
});

it("includes a notification mark", async () => {
Expand All @@ -60,7 +60,7 @@ describe("if there are issues", () => {

describe("if there are not issues", () => {
beforeEach(() => {
hasIssues = false;
mockIssues = {};
});

it("does not include a notification mark", async () => {
Expand Down

0 comments on commit 5cca4da

Please sign in to comment.