From 61d615c04b2aa629e33affd0afc6e400b863300d Mon Sep 17 00:00:00 2001 From: rafaelsideguide <150964962+rafaelsideguide@users.noreply.github.com> Date: Tue, 7 May 2024 14:03:00 -0300 Subject: [PATCH] Added tests --- apps/api/src/__tests__/e2e_withAuth/index.test.ts | 9 +++++++-- apps/api/src/scraper/WebScraper/index.ts | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/api/src/__tests__/e2e_withAuth/index.test.ts b/apps/api/src/__tests__/e2e_withAuth/index.test.ts index 9a16073..3e82fb4 100644 --- a/apps/api/src/__tests__/e2e_withAuth/index.test.ts +++ b/apps/api/src/__tests__/e2e_withAuth/index.test.ts @@ -280,8 +280,13 @@ describe("E2E Tests for API Routes", () => { expect(completedResponse.statusCode).toBe(200); expect(completedResponse.body).toHaveProperty("status"); expect(completedResponse.body.status).toBe("failed"); - - + expect(completedResponse.body).toHaveProperty("data"); + expect(completedResponse.body.data).toEqual(null); + expect(completedResponse.body).toHaveProperty("partial_data"); + expect(completedResponse.body.partial_data[0]).toHaveProperty("content"); + expect(completedResponse.body.partial_data[0]).toHaveProperty("markdown"); + expect(completedResponse.body.partial_data[0]).toHaveProperty("metadata"); + }, 60000); // 60 seconds diff --git a/apps/api/src/scraper/WebScraper/index.ts b/apps/api/src/scraper/WebScraper/index.ts index 3a77843..96112f8 100644 --- a/apps/api/src/scraper/WebScraper/index.ts +++ b/apps/api/src/scraper/WebScraper/index.ts @@ -80,7 +80,9 @@ export class WebScraperDataProvider { ); } } - } catch (error) {} + } catch (error) { + console.error(error); + } } return results.filter((result) => result !== null) as Document[]; }