Skip to content

Commit

Permalink
test: make notification test a bit more robust by clearing any previo…
Browse files Browse the repository at this point in the history
…us notifications queued
  • Loading branch information
Tethik committed Oct 17, 2024
1 parent 232991a commit 4fa3855
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion core/src/data/threats/ThreatDataService.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { randomUUID } from "crypto";
import pg from "pg";
import Control from "../controls/Control.js";
import { DataAccessLayer } from "../dal.js";
import Mitigation from "../mitigations/Mitigation.js";
Expand Down
5 changes: 5 additions & 0 deletions core/src/notifications/sender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ describe("notification sender", () => {
notificationService = new NotificationDataService(dal);
});

beforeEach(async () => {
await notificationService._truncate();
});

afterAll(async () => {
await dal.pool.end();
});
Expand Down Expand Up @@ -101,6 +105,7 @@ describe("notification sender", () => {
const mockFn = (mockedSend as Mock).mockImplementation(async () => true);

await notificationService.queue(sampleNotification);

for (let i = 0; i < 3; i++) {
await notificationSender(
notificationService,
Expand Down

0 comments on commit 4fa3855

Please sign in to comment.