From 2856989239e725cd7b1d78fda87083e0ee909afe Mon Sep 17 00:00:00 2001 From: CahidArda Date: Mon, 24 Jun 2024 21:41:17 +0300 Subject: [PATCH] fix: clear queues after finishing client tests --- src/client/client.test.ts | 9 +++++++++ src/client/queue.test.ts | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/client/client.test.ts b/src/client/client.test.ts index 3b3777c..82c91e4 100644 --- a/src/client/client.test.ts +++ b/src/client/client.test.ts @@ -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/", diff --git a/src/client/queue.test.ts b/src/client/queue.test.ts index cd91cfb..e780eef 100644 --- a/src/client/queue.test.ts +++ b/src/client/queue.test.ts @@ -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); }); test("should create multiple queue, verify them then remove them", async () => {