diff --git a/apps/api/src/controllers/search.ts b/apps/api/src/controllers/search.ts index b555197..8cb6d55 100644 --- a/apps/api/src/controllers/search.ts +++ b/apps/api/src/controllers/search.ts @@ -91,6 +91,7 @@ export async function searchHelper( }); const docs = await a.getDocuments(false); + if (docs.length === 0) { return { success: true, error: "No search results found", returnCode: 200 }; } diff --git a/apps/js-sdk/firecrawl/package-lock.json b/apps/js-sdk/firecrawl/package-lock.json index 7094cc9..906ab47 100644 --- a/apps/js-sdk/firecrawl/package-lock.json +++ b/apps/js-sdk/firecrawl/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mendable/firecrawl-js", - "version": "0.0.26", + "version": "0.0.28", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mendable/firecrawl-js", - "version": "0.0.26", + "version": "0.0.28", "license": "MIT", "dependencies": { "axios": "^1.6.8", @@ -20,6 +20,7 @@ "@types/axios": "^0.14.0", "@types/dotenv": "^8.2.0", "@types/jest": "^29.5.12", + "@types/mocha": "^10.0.6", "@types/node": "^20.12.12", "@types/uuid": "^9.0.8", "jest": "^29.7.0", @@ -1071,6 +1072,12 @@ "pretty-format": "^29.0.0" } }, + "node_modules/@types/mocha": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.6.tgz", + "integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==", + "dev": true + }, "node_modules/@types/node": { "version": "20.12.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json index b162882..71cf91a 100644 --- a/apps/js-sdk/firecrawl/package.json +++ b/apps/js-sdk/firecrawl/package.json @@ -33,6 +33,7 @@ "@types/axios": "^0.14.0", "@types/dotenv": "^8.2.0", "@types/jest": "^29.5.12", + "@types/mocha": "^10.0.6", "@types/node": "^20.12.12", "@types/uuid": "^9.0.8", "jest": "^29.7.0", diff --git a/apps/js-sdk/firecrawl/src/__tests__/e2e_withAuth/index.test.ts b/apps/js-sdk/firecrawl/src/__tests__/e2e_withAuth/index.test.ts index 2725c23..af6aa84 100644 --- a/apps/js-sdk/firecrawl/src/__tests__/e2e_withAuth/index.test.ts +++ b/apps/js-sdk/firecrawl/src/__tests__/e2e_withAuth/index.test.ts @@ -2,6 +2,7 @@ import FirecrawlApp from '../../index'; import { v4 as uuidv4 } from 'uuid'; import dotenv from 'dotenv'; + dotenv.config(); const TEST_API_KEY = process.env.TEST_API_KEY; @@ -29,14 +30,14 @@ describe('FirecrawlApp E2E Tests', () => { const app = new FirecrawlApp({ apiKey: "this_is_just_a_preview_token", apiUrl: API_URL }); const response = await app.scrapeUrl('https://roastmywebsite.ai'); expect(response).not.toBeNull(); - expect(response.data.content).toContain("_Roast_"); + expect(response.data?.content).toContain("_Roast_"); }, 30000); // 30 seconds timeout test.concurrent('should return successful response for valid scrape', async () => { const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL }); const response = await app.scrapeUrl('https://roastmywebsite.ai'); expect(response).not.toBeNull(); - expect(response.data.content).toContain("_Roast_"); + expect(response.data?.content).toContain("_Roast_"); expect(response.data).toHaveProperty('markdown'); expect(response.data).toHaveProperty('metadata'); expect(response.data).not.toHaveProperty('html'); @@ -46,23 +47,23 @@ describe('FirecrawlApp E2E Tests', () => { const app = new FirecrawlApp({ apiKey: TEST_API_KEY, apiUrl: API_URL }); const response = await app.scrapeUrl('https://roastmywebsite.ai', { pageOptions: { includeHtml: true } }); expect(response).not.toBeNull(); - expect(response.data.content).toContain("_Roast_"); - expect(response.data.markdown).toContain("_Roast_"); - expect(response.data.html).toContain("