The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add expectedWorkspace to create-workspace test
Kiran K6cb7a812ae71
diff --git a/apps/web/tests/utils/schema.ts b/apps/web/tests/utils/schema.tsindex 1717a19266..99746319c9 100644--- a/apps/web/tests/utils/schema.ts+++ b/apps/web/tests/utils/schema.ts@@ -1,4 +1,4 @@-import { Link, Tag } from "@prisma/client";+import { Link, Project, Tag } from "@prisma/client";import { expect } from "vitest";export const expectedLink: Partial<Link> = {@@ -35,3 +35,22 @@ export const expectedTag: Partial<Tag> = {createdAt: expect.any(String),updatedAt: expect.any(String),};++export const expectedWorkspace: Partial<Project> = {+ id: expect.any(String),+ logo: null,+ plan: "free",+ stripeId: null,+ billingCycleStart: 4,+ usage: 0,+ usageLimit: 1000,+ linksUsage: 0,+ linksLimit: 25,+ domainsLimit: 3,+ tagsLimit: 5,+ usersLimit: 1,+ monitoringId: null,+ inviteCode: expect.any(String),+ createdAt: expect.any(String),+ updatedAt: expect.any(String),+};diff --git a/apps/web/tests/workspaces/create-workspace.test.ts b/apps/web/tests/workspaces/create-workspace.test.tsindex 044b2f810f..f34a95b393 100644--- a/apps/web/tests/workspaces/create-workspace.test.ts+++ b/apps/web/tests/workspaces/create-workspace.test.ts@@ -4,6 +4,7 @@ import { Project } from "@prisma/client";import { IntegrationHarness } from "../utils/integration";import { nanoid } from "@dub/utils";import slugify from "@sindresorhus/slugify";+import { expectedWorkspace } from "../utils/schema";test("creates new workspace", async (ctx) => {const h = new IntegrationHarness(ctx);@@ -29,25 +30,10 @@ test("creates new workspace", async (ctx) => {expect(status).toEqual(200);expect(workspace).toEqual({- id: expect.any(String),+ ...expectedWorkspace,name,slug,- logo: null,- plan: "free",- stripeId: null,- billingCycleStart: 4,- usage: 0,- usageLimit: 1000,- linksUsage: 0,- linksLimit: 25,- domainsLimit: 3,- tagsLimit: 5,- usersLimit: 1,- monitoringId: null,domains: [],- inviteCode: expect.any(String),- createdAt: expect.any(String),- updatedAt: expect.any(String),});await http.delete({@@ -55,6 +41,8 @@ test("creates new workspace", async (ctx) => {});});+// TODO:+// Move this to error handling teststest("should not create workspace with slug in use", async (ctx) => {const h = new IntegrationHarness(ctx);const { apiKey } = await h.init();