Skip to content

Commit

Permalink
Add flush-promises to avoid error after tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
kentdr committed Jan 22, 2025
1 parent 071cb55 commit 6e012fd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Frontend/test/specs/heartbeats/menu-item.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { test, describe } from "../../drivers/vitest/driver";
import * as precondition from "../../preconditions";
import { queryHeartbeatMenuItem } from "./questions/queryHeartbeatMenuItem";
import { waitFor } from "@testing-library/vue";
import flushPromises from "flush-promises";

describe("FEATURE: Menu item", () => {
describe("RULE: The count of inactive endpoints should be displayed in the navigation menu", () => {
Expand All @@ -18,6 +19,8 @@ describe("FEATURE: Menu item", () => {
expect(heartbeatMenuItem && heartbeatMenuItem.isCounterVisible).toBeTruthy();
expect(heartbeatMenuItem && heartbeatMenuItem.counterValue).toBe(1);
});

await flushPromises();
});

/* SCENARIO
Expand Down Expand Up @@ -52,6 +55,7 @@ describe("FEATURE: Menu item", () => {
});

vi.restoreAllMocks();
await flushPromises();
});

/* SCENARIO
Expand All @@ -71,6 +75,8 @@ describe("FEATURE: Menu item", () => {
expect(heartbeatMenuItem && !heartbeatMenuItem.isCounterVisible).toBeTruthy();
expect(heartbeatMenuItem && heartbeatMenuItem.counterValue).toBe(0);
});

await flushPromises();
});
});
});

0 comments on commit 6e012fd

Please sign in to comment.