The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
make sure bounties are deleted after test complete
Steven Tey6bf42a056d51
diff --git a/apps/web/tests/bounties/index.test.ts b/apps/web/tests/bounties/index.test.tsindex 9bc16d1c30..b75ef73161 100644--- a/apps/web/tests/bounties/index.test.ts+++ b/apps/web/tests/bounties/index.test.ts@@ -1,7 +1,7 @@import { Bounty, BountyStartMode } from "@prisma/client";import { addDays, addMonths, subDays } from "date-fns";import { E2E_PARTNER_GROUP } from "tests/utils/resource";-import { describe, expect, onTestFinished, test } from "vitest";+import { describe, expect, onTestFinished, test, afterAll } from "vitest";import { IntegrationHarness } from "../utils/integration";// start 5 mins from now to make sure the bounty is fully deleted so it doesn't trigger email sends@@ -592,6 +592,8 @@ describe.sequential("/bounties - relative start mode", async () => {const h = new IntegrationHarness();const { http } = await h.init();+ const createdBountyIds: string[] = [];+const relativeSubmissionBase = {name: "Relative Submission Bounty",description: "starts when a partner joins",@@ -604,6 +606,12 @@ describe.sequential("/bounties - relative start mode", async () => {groupIds: [E2E_PARTNER_GROUP.id],};+ afterAll(async () => {+ await Promise.all(+ createdBountyIds.map((bountyId) => h.deleteBounty(bountyId)),+ );+ });+test("POST /bounties - relative with endsAfterDays", async () => {const { status, data: bounty } = await http.post<Bounty>({path: "/bounties",@@ -621,6 +629,11 @@ describe.sequential("/bounties - relative start mode", async () => {endsAfterDays: 30,});+ createdBountyIds.push(bounty.id);+ onTestFinished(async () => {+ await h.deleteBounty(bounty.id);+ });+const { status: patchStatus, data: updated } = await http.patch<Bounty>({path: `/bounties/${bounty.id}`,body: { endsAfterDays: 180 },@@ -632,10 +645,6 @@ describe.sequential("/bounties - relative start mode", async () => {startsAt: null,endsAfterDays: 180,});-- onTestFinished(async () => {- await h.deleteBounty(bounty.id);- });});test("POST /bounties - relative with startsAt is rejected", async () => {