Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix tests final

Steven Tey9f6b44464749
diff --git a/apps/web/lib/zod/schemas/bounties.ts b/apps/web/lib/zod/schemas/bounties.ts
index 54a579a7f5..d4601bb460 100644
--- a/apps/web/lib/zod/schemas/bounties.ts
+++ b/apps/web/lib/zod/schemas/bounties.ts
@@ -121,7 +121,10 @@ export const createBountySchema = z.object({
performanceCondition: awardBountyConditionSchema.nullish(),
performanceScope: z.enum(BountyPerformanceScope).nullish(),
sendNotificationEmails: z.boolean().optional(),
- startMode: z.enum(BountyStartMode).optional(),
+ startMode: z
+ .enum(BountyStartMode)
+ .optional()
+ .default(BountyStartMode.absolute),
endsAfterDays: z.number().int().positive().nullish(),
});
diff --git a/apps/web/tests/bounties/index.test.ts b/apps/web/tests/bounties/index.test.ts
index c9fc630224..5c6cb5057b 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, afterAll } from "vitest";
+import { describe, expect, onTestFinished, test } 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,8 +592,6 @@ 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",
@@ -606,12 +604,6 @@ 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",
@@ -629,8 +621,6 @@ describe.sequential("/bounties - relative start mode", async () => {
endsAfterDays: 30,
});
- createdBountyIds.push(bounty.id);
-
const { status: patchStatus, data: updated } = await http.patch<Bounty>({
path: `/bounties/${bounty.id}`,
body: { endsAfterDays: 180 },
@@ -642,6 +632,10 @@ 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 () => {
@@ -662,6 +656,10 @@ describe.sequential("/bounties - relative start mode", async () => {
code: "bad_request",
},
});
+
+ onTestFinished(async () => {
+ await h.deleteBounty(bounty.id);
+ });
});
test("POST /bounties - both endsAt and endsAfterDays is rejected", async () => {