From 05eaa3c68d22bdf88fbc21e9a7c8a6efbdf9f62e Mon Sep 17 00:00:00 2001 From: rafaelsideguide <150964962+rafaelsideguide@users.noreply.github.com> Date: Wed, 26 Jun 2024 09:32:02 -0300 Subject: [PATCH 1/2] Update index.test.ts --- .../__tests__/e2e_full_withAuth/index.test.ts | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/api/src/__tests__/e2e_full_withAuth/index.test.ts b/apps/api/src/__tests__/e2e_full_withAuth/index.test.ts index 9f04093a..c8281edd 100644 --- a/apps/api/src/__tests__/e2e_full_withAuth/index.test.ts +++ b/apps/api/src/__tests__/e2e_full_withAuth/index.test.ts @@ -83,8 +83,31 @@ describe("E2E Tests for API Routes", () => { expect(response.body.data).toHaveProperty("metadata"); expect(response.body.data).not.toHaveProperty("html"); expect(response.body.data.content).toContain("_Roast_"); - expect(response.body.data.metadata.pageStatusCode).toBe(200); + expect(response.body.data.metadata).toHaveProperty("title"); + expect(response.body.data.metadata).toHaveProperty("description"); + expect(response.body.data.metadata).toHaveProperty("keywords"); + expect(response.body.data.metadata).toHaveProperty("robots"); + expect(response.body.data.metadata).toHaveProperty("ogTitle"); + expect(response.body.data.metadata).toHaveProperty("ogDescription"); + expect(response.body.data.metadata).toHaveProperty("ogUrl"); + expect(response.body.data.metadata).toHaveProperty("ogImage"); + expect(response.body.data.metadata).toHaveProperty("ogLocaleAlternate"); + expect(response.body.data.metadata).toHaveProperty("ogSiteName"); + expect(response.body.data.metadata).toHaveProperty("sourceURL"); + expect(response.body.data.metadata).toHaveProperty("pageStatusCode"); expect(response.body.data.metadata.pageError).toBeUndefined(); + expect(response.body.data.metadata.title).toBe("Roast My Website"); + expect(response.body.data.metadata.description).toBe("Welcome to Roast My Website, the ultimate tool for putting your website through the wringer! This repository harnesses the power of Firecrawl to scrape and capture screenshots of websites, and then unleashes the latest LLM vision models to mercilessly roast them. 🌶️"); + expect(response.body.data.metadata.keywords).toBe("Roast My Website,Roast,Website,GitHub,Firecrawl"); + expect(response.body.data.metadata.robots).toBe("follow, index"); + expect(response.body.data.metadata.ogTitle).toBe("Roast My Website"); + expect(response.body.data.metadata.ogDescription).toBe("Welcome to Roast My Website, the ultimate tool for putting your website through the wringer! This repository harnesses the power of Firecrawl to scrape and capture screenshots of websites, and then unleashes the latest LLM vision models to mercilessly roast them. 🌶️"); + expect(response.body.data.metadata.ogUrl).toBe("https://www.roastmywebsite.ai"); + expect(response.body.data.metadata.ogImage).toBe("https://www.roastmywebsite.ai/og.png"); + expect(response.body.data.metadata.ogLocaleAlternate).toStrictEqual([]); + expect(response.body.data.metadata.ogSiteName).toBe("Roast My Website"); + expect(response.body.data.metadata.sourceURL).toBe("https://roastmywebsite.ai"); + expect(response.body.data.metadata.pageStatusCode).toBe(200); }, 30000); // 30 seconds timeout it.concurrent("should return a successful response with a valid API key and includeHtml set to true", async () => { From 67d7650cf3b6e2ce5df50bfc8d6ed60505dd2899 Mon Sep 17 00:00:00 2001 From: rafaelsideguide <150964962+rafaelsideguide@users.noreply.github.com> Date: Wed, 26 Jun 2024 12:07:55 -0300 Subject: [PATCH 2/2] Added to e2e_noAuth --- apps/api/src/__tests__/e2e_withAuth/index.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/api/src/__tests__/e2e_withAuth/index.test.ts b/apps/api/src/__tests__/e2e_withAuth/index.test.ts index 8403fd76..c163aa60 100644 --- a/apps/api/src/__tests__/e2e_withAuth/index.test.ts +++ b/apps/api/src/__tests__/e2e_withAuth/index.test.ts @@ -50,8 +50,19 @@ describe("E2E Tests for API Routes", () => { expect(response.body.data).toHaveProperty("metadata"); expect(response.body.data).not.toHaveProperty("html"); expect(response.body.data.content).toContain("_Roast_"); - expect(response.body.data.metadata.pageStatusCode).toBe(200); expect(response.body.data.metadata.pageError).toBeUndefined(); + expect(response.body.data.metadata.title).toBe("Roast My Website"); + expect(response.body.data.metadata.description).toBe("Welcome to Roast My Website, the ultimate tool for putting your website through the wringer! This repository harnesses the power of Firecrawl to scrape and capture screenshots of websites, and then unleashes the latest LLM vision models to mercilessly roast them. 🌶️"); + expect(response.body.data.metadata.keywords).toBe("Roast My Website,Roast,Website,GitHub,Firecrawl"); + expect(response.body.data.metadata.robots).toBe("follow, index"); + expect(response.body.data.metadata.ogTitle).toBe("Roast My Website"); + expect(response.body.data.metadata.ogDescription).toBe("Welcome to Roast My Website, the ultimate tool for putting your website through the wringer! This repository harnesses the power of Firecrawl to scrape and capture screenshots of websites, and then unleashes the latest LLM vision models to mercilessly roast them. 🌶️"); + expect(response.body.data.metadata.ogUrl).toBe("https://www.roastmywebsite.ai"); + expect(response.body.data.metadata.ogImage).toBe("https://www.roastmywebsite.ai/og.png"); + expect(response.body.data.metadata.ogLocaleAlternate).toStrictEqual([]); + expect(response.body.data.metadata.ogSiteName).toBe("Roast My Website"); + expect(response.body.data.metadata.sourceURL).toBe("https://roastmywebsite.ai"); + expect(response.body.data.metadata.pageStatusCode).toBe(200); }, 30000); // 30 seconds timeout