Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
test(web): add unit tests for Iframely crawler detection
Richie McIlroy9e2be938983d
diff --git a/apps/web/__tests__/unit/social-crawlers.test.ts b/apps/web/__tests__/unit/social-crawlers.test.tsnew file mode 100644index 000000000..9ca5cbf44--- /dev/null+++ b/apps/web/__tests__/unit/social-crawlers.test.ts@@ -0,0 +1,22 @@+import { describe, expect, it } from "vitest";+import {+ isIframelyCrawlerUserAgent,+ isSocialCrawlerUserAgent,+} from "@/lib/social-crawlers";++describe("social crawler detection", () => {+ it.each([+ "Iframely/1.3.1 (+https://iframely.com/docs/about)",+ "Iframely/2.0.0 (+https://iframely.com/docs/about) Notion",+ ])("recognizes Iframely user agent %s", (userAgent) => {+ expect(isSocialCrawlerUserAgent(userAgent)).toBe(true);+ expect(isIframelyCrawlerUserAgent(userAgent)).toBe(true);+ });++ it("does not treat a normal browser as a crawler", () => {+ const userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)";++ expect(isSocialCrawlerUserAgent(userAgent)).toBe(false);+ expect(isIframelyCrawlerUserAgent(userAgent)).toBe(false);+ });+});