Skip to content

Commit

Permalink
fix: clear queues after finishing client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CahidArda committed Jun 24, 2024
1 parent f0604aa commit 2856989
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/client/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import { Client } from "./client";
describe("E2E Publish", () => {
const client = new Client({ token: process.env.QSTASH_TOKEN! });

afterAll(async () => {
const queueDetails = await client.queue().list();
await Promise.all(
queueDetails.map(async (q) => {
await client.queue({ queueName: q.name }).delete();
})
);
});

test("should publish a json message", async () => {
const result = await client.publishJSON({
url: "https://example.com/",
Expand Down
3 changes: 3 additions & 0 deletions src/client/queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe("Queue", () => {
expect(queueDetails.name).toEqual(queueName);

await client.queue({ queueName }).delete();

const queues = await client.queue().list();
expect(queues.length).toBe(0);

Check failure on line 28 in src/client/queue.test.ts

View workflow job for this annotation

GitHub Actions / QStash Tests

error: expect(received).toBe(expected)

Expected: 0 Received: 3 at /home/runner/work/qstash-js/qstash-js/src/client/queue.test.ts:28:27
});

test("should create multiple queue, verify them then remove them", async () => {
Expand Down

0 comments on commit 2856989

Please sign in to comment.