Skip to content

Commit

Permalink
queueByName Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyri113 committed May 21, 2023
1 parent 34f0895 commit 7986590
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions __test__/queues/queueByName.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import emailQueue from "../../src/queues/email.queue";
import imageProcessingQueue from "../../src/queues/imageProcessing.queue";
import queueByName from "../../src/queues/queueByName";

describe("queueByName", () => {
it("should return emailQueue for name 'email'", () => {
expect(queueByName("email")).toBe(emailQueue);
});

it("should return imageProcessingQueue for name 'imageProcessing'", () => {
expect(queueByName("imageProcessing")).toBe(imageProcessingQueue);
});

it("should throw an error for unknown queue name", () => {
const unknownName = "unknownQueue";
const expectedErrorMessage = `No Queue called ${unknownName}`;
expect(() => queueByName(unknownName)).toThrowError(expectedErrorMessage);
});
});

0 comments on commit 7986590

Please sign in to comment.