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.

format the test files

Kiran K5854e75ee553
diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts
index cdde01371d..1237a40cdc 100644
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@ -1,8 +1,8 @@
import z from "@/lib/zod";
+import { metaTagsSchema } from "@/lib/zod/schemas/metatags";
import { DirectorySyncProviders } from "@boxyhq/saml-jackson";
import { Link } from "@prisma/client";
import { createLinkBodySchema } from "./zod/schemas/links";
-import { metaTagsSchema } from "@/lib/zod/schemas/metatags";
export type LinkProps = Link;
diff --git a/apps/web/lib/zod/schemas/metatags.ts b/apps/web/lib/zod/schemas/metatags.ts
index 4e4c6ee534..42abffc375 100644
--- a/apps/web/lib/zod/schemas/metatags.ts
+++ b/apps/web/lib/zod/schemas/metatags.ts
@@ -7,4 +7,4 @@ export const metaTagsSchema = z.object({
.nullable()
.describe("The meta description tag for the URL"),
image: z.string().nullable().describe("The OpenGraph image for the URL"),
-});
\ No newline at end of file
+});
diff --git a/apps/web/tests/links/create-link-error.test.ts b/apps/web/tests/links/create-link-error.test.ts
index 208be745b0..5c5ff5d306 100644
--- a/apps/web/tests/links/create-link-error.test.ts
+++ b/apps/web/tests/links/create-link-error.test.ts
@@ -1,6 +1,6 @@
+import { Link } from "@prisma/client";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Link } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
const domain = "dub.sh";
diff --git a/apps/web/tests/links/create-link.test.ts b/apps/web/tests/links/create-link.test.ts
index 87ac3c6277..caf0840d2a 100644
--- a/apps/web/tests/links/create-link.test.ts
+++ b/apps/web/tests/links/create-link.test.ts
@@ -1,9 +1,9 @@
-import { expect, test, describe, beforeAll, afterAll } from "vitest";
-import { HttpClient } from "../utils/http";
+import { nanoid } from "@dub/utils";
import { Link } from "@prisma/client";
+import { afterAll, describe, expect, test } from "vitest";
+import { HttpClient } from "../utils/http";
import { IntegrationHarness } from "../utils/integration";
import { expectedLink } from "../utils/schema";
-import { nanoid } from "@dub/utils";
const domain = "dub.sh";
diff --git a/apps/web/tests/links/list-links.test.ts b/apps/web/tests/links/list-links.test.ts
index 7592b7e699..d5785126b2 100644
--- a/apps/web/tests/links/list-links.test.ts
+++ b/apps/web/tests/links/list-links.test.ts
@@ -1,6 +1,6 @@
+import { Link } from "@prisma/client";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Link } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
import { expectedLink } from "../utils/schema";
@@ -43,32 +43,30 @@ test("list links", async (ctx) => {
expect(status).toEqual(200);
expect(links.length).toEqual(2);
- expect(links).toEqual(
- [
- {
- ...expectedLink,
- domain,
- url,
- userId: user.id,
- projectId: workspace.id,
- workspaceId: workspace.workspaceId,
- tags: [],
- shortLink: `https://${domain}/${secondLink.key}`,
- qrCode: `https://api.dub.co/qr?url=https://${domain}/${secondLink.key}?qr=1`,
- user: JSON.parse(JSON.stringify(user)),
- },
- {
- ...expectedLink,
- domain,
- url,
- userId: user.id,
- projectId: workspace.id,
- workspaceId: workspace.workspaceId,
- tags: [],
- shortLink: `https://${domain}/${firstLink.key}`,
- qrCode: `https://api.dub.co/qr?url=https://${domain}/${firstLink.key}?qr=1`,
- user: JSON.parse(JSON.stringify(user)),
- },
- ],
- );
+ expect(links).toEqual([
+ {
+ ...expectedLink,
+ domain,
+ url,
+ userId: user.id,
+ projectId: workspace.id,
+ workspaceId: workspace.workspaceId,
+ tags: [],
+ shortLink: `https://${domain}/${secondLink.key}`,
+ qrCode: `https://api.dub.co/qr?url=https://${domain}/${secondLink.key}?qr=1`,
+ user: JSON.parse(JSON.stringify(user)),
+ },
+ {
+ ...expectedLink,
+ domain,
+ url,
+ userId: user.id,
+ projectId: workspace.id,
+ workspaceId: workspace.workspaceId,
+ tags: [],
+ shortLink: `https://${domain}/${firstLink.key}`,
+ qrCode: `https://api.dub.co/qr?url=https://${domain}/${firstLink.key}?qr=1`,
+ user: JSON.parse(JSON.stringify(user)),
+ },
+ ]);
});
diff --git a/apps/web/tests/links/update-link.test.ts b/apps/web/tests/links/update-link.test.ts
index 62e8761952..2c17fcf9be 100644
--- a/apps/web/tests/links/update-link.test.ts
+++ b/apps/web/tests/links/update-link.test.ts
@@ -1,9 +1,9 @@
+import { nanoid } from "@dub/utils";
+import { Link } from "@prisma/client";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Link } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
import { expectedLink } from "../utils/schema";
-import { nanoid } from "@dub/utils";
test("update an existing link", async (ctx) => {
const h = new IntegrationHarness(ctx);
diff --git a/apps/web/tests/metatags/retrieve-metatags.test.ts b/apps/web/tests/metatags/retrieve-metatags.test.ts
index 72ff90f084..35d733b95f 100644
--- a/apps/web/tests/metatags/retrieve-metatags.test.ts
+++ b/apps/web/tests/metatags/retrieve-metatags.test.ts
@@ -1,7 +1,7 @@
+import { MetaTag } from "@/lib/types";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
import { IntegrationHarness } from "../utils/integration";
-import { MetaTag } from "@/lib/types";
test("retrieve the metatags for a URL", async (ctx) => {
const h = new IntegrationHarness(ctx);
diff --git a/apps/web/tests/tags/create-tag-error.test.ts b/apps/web/tests/tags/create-tag-error.test.ts
index 6eb895d488..690287ad6b 100644
--- a/apps/web/tests/tags/create-tag-error.test.ts
+++ b/apps/web/tests/tags/create-tag-error.test.ts
@@ -1,6 +1,6 @@
+import { Tag } from "@prisma/client";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Tag } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
const cases = [
diff --git a/apps/web/tests/tags/create-tag.test.ts b/apps/web/tests/tags/create-tag.test.ts
index 4abf43a3f6..d5fb5fa44e 100644
--- a/apps/web/tests/tags/create-tag.test.ts
+++ b/apps/web/tests/tags/create-tag.test.ts
@@ -1,6 +1,6 @@
+import { Tag } from "@prisma/client";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Tag } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
import { expectedTag } from "../utils/schema";
diff --git a/apps/web/tests/tags/list-tags.test.ts b/apps/web/tests/tags/list-tags.test.ts
index bdb95f82d8..9f6278bb30 100644
--- a/apps/web/tests/tags/list-tags.test.ts
+++ b/apps/web/tests/tags/list-tags.test.ts
@@ -1,6 +1,6 @@
+import { Tag } from "@prisma/client";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Tag } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
test("retrieve list of tags", async (ctx) => {
diff --git a/apps/web/tests/workspaces/create-workspace-error.test.ts b/apps/web/tests/workspaces/create-workspace-error.test.ts
index 8efbcb266c..5c04c87990 100644
--- a/apps/web/tests/workspaces/create-workspace-error.test.ts
+++ b/apps/web/tests/workspaces/create-workspace-error.test.ts
@@ -1,9 +1,9 @@
+import { nanoid } from "@dub/utils";
+import { Project } from "@prisma/client";
+import slugify from "@sindresorhus/slugify";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Project } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
-import { nanoid } from "@dub/utils";
-import slugify from "@sindresorhus/slugify";
test("should not create workspace with slug in use", async (ctx) => {
const h = new IntegrationHarness(ctx);
diff --git a/apps/web/tests/workspaces/create-workspace.test.ts b/apps/web/tests/workspaces/create-workspace.test.ts
index 55e393ff4a..5cbe8e2150 100644
--- a/apps/web/tests/workspaces/create-workspace.test.ts
+++ b/apps/web/tests/workspaces/create-workspace.test.ts
@@ -1,9 +1,9 @@
+import { nanoid } from "@dub/utils";
+import { Project } from "@prisma/client";
+import slugify from "@sindresorhus/slugify";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-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) => {
diff --git a/apps/web/tests/workspaces/list-workspaces.test.ts b/apps/web/tests/workspaces/list-workspaces.test.ts
index 5816010158..4172bd7ccb 100644
--- a/apps/web/tests/workspaces/list-workspaces.test.ts
+++ b/apps/web/tests/workspaces/list-workspaces.test.ts
@@ -1,10 +1,10 @@
+import { nanoid } from "@dub/utils";
+import { Project } from "@prisma/client";
+import slugify from "@sindresorhus/slugify";
import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
-import { Project } from "@prisma/client";
import { IntegrationHarness } from "../utils/integration";
import { expectedWorkspace } from "../utils/schema";
-import slugify from "@sindresorhus/slugify";
-import { nanoid } from "@dub/utils";
test("retrieve list of workspaces", async (ctx) => {
const h = new IntegrationHarness(ctx);
diff --git a/apps/web/tests/workspaces/retrieve-workspace.error.test.ts b/apps/web/tests/workspaces/retrieve-workspace.error.test.ts
index 4ad156a623..b3d64f1ab9 100644
--- a/apps/web/tests/workspaces/retrieve-workspace.error.test.ts
+++ b/apps/web/tests/workspaces/retrieve-workspace.error.test.ts
@@ -1,5 +1,5 @@
import { Project } from "@prisma/client";
-import { describe, expect, test } from "vitest";
+import { expect, test } from "vitest";
import { HttpClient } from "../utils/http";
import { IntegrationHarness } from "../utils/integration";
@@ -23,4 +23,4 @@ test("retrieve a workspace by invalid slug or id", async (ctx) => {
expect(status).toEqual(404);
// Add error
-});
\ No newline at end of file
+});
diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.ts
index d2471898de..a6d76589c0 100644
--- a/apps/web/vitest.config.ts
+++ b/apps/web/vitest.config.ts
@@ -1,5 +1,5 @@
-import { defineConfig } from "vitest/config";
import tsconfigPaths from "vite-tsconfig-paths";
+import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [tsconfigPaths()],