Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

dub stuff

Richie McIlroy3177438beed9
diff --git a/apps/web/__tests__/unit/og-images.test.ts b/apps/web/__tests__/unit/og-images.test.ts
index f026e1a36..f6b67c692 100644
--- a/apps/web/__tests__/unit/og-images.test.ts
+++ b/apps/web/__tests__/unit/og-images.test.ts
@@ -1,5 +1,6 @@
import { NextRequest } from "next/server";
-import { describe, expect, it } from "vitest";
+import { describe, expect, it, vi } from "vitest";
+import { dub } from "../../../../packages/utils/src/lib/dub";
import { GET as getMarketingOg } from "../../app/api/og/route";
import { signOgParams, verifyOgSignature } from "../../lib/og/signature";
import { ogImageUrl } from "../../lib/og/url";
@@ -156,3 +157,18 @@ describe("rich share link", () => {
expect(html).toContain("<img src=");
});
});
+
+describe("Dub link creation", () => {
+ it("does not make a network request", async () => {
+ const fetchSpy = vi.spyOn(globalThis, "fetch");
+
+ await dub().links.create({
+ url: "https://cap.so/s/abc123",
+ domain: "cap.link",
+ key: "abc123",
+ });
+
+ expect(fetchSpy).not.toHaveBeenCalled();
+ fetchSpy.mockRestore();
+ });
+});
diff --git a/packages/utils/src/lib/dub.ts b/packages/utils/src/lib/dub.ts
index 64993a9ec..dc426fbb5 100644
--- a/packages/utils/src/lib/dub.ts
+++ b/packages/utils/src/lib/dub.ts
@@ -1,5 +1,6 @@
export const dub = () => ({
links: {
- create: () => Promise.resolve(),
+ create: (_input: { url: string; domain: string; key: string }) =>
+ Promise.resolve(),
},
});