From 5be208f5950dec85823bf9c82ab4e9084249aec2 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 17 May 2024 10:40:44 -0700 Subject: [PATCH] Nick: fixed --- apps/api/src/__tests__/e2e_withAuth/index.test.ts | 4 ++-- apps/api/src/scraper/WebScraper/utils/pdfProcessor.ts | 2 +- 2 files changed, 3 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 3fe10222..abe5c58d 100644 --- a/apps/api/src/__tests__/e2e_withAuth/index.test.ts +++ b/apps/api/src/__tests__/e2e_withAuth/index.test.ts @@ -584,7 +584,7 @@ describe("E2E Tests for API Routes", () => { .post('/v0/crawl') .set('Authorization', `Bearer ${process.env.TEST_API_KEY}`) .set('Content-Type', 'application/json') - .send({ url: 'https://arxiv.org/abs/astro-ph/9301001', crawlerOptions: { limit: 10, excludes: [ 'list/*', 'login', 'abs/*', 'static/*', 'about/*', 'archive/*' ] }}); + .send({ url: 'https://arxiv.org/pdf/astro-ph/9301001', crawlerOptions: { limit: 10, excludes: [ 'list/*', 'login', 'abs/*', 'static/*', 'about/*', 'archive/*' ] }}); expect(crawlResponse.statusCode).toBe(200); let isCompleted = false; @@ -606,7 +606,7 @@ describe("E2E Tests for API Routes", () => { } expect(completedResponse.body.status).toBe('completed'); expect(completedResponse.body).toHaveProperty('data'); - expect(completedResponse.body.data.length).toBeGreaterThan(1); + expect(completedResponse.body.data.length).toEqual(1); expect(completedResponse.body.data).toEqual( expect.arrayContaining([ expect.objectContaining({ diff --git a/apps/api/src/scraper/WebScraper/utils/pdfProcessor.ts b/apps/api/src/scraper/WebScraper/utils/pdfProcessor.ts index ba92fd4a..7c570071 100644 --- a/apps/api/src/scraper/WebScraper/utils/pdfProcessor.ts +++ b/apps/api/src/scraper/WebScraper/utils/pdfProcessor.ts @@ -80,7 +80,7 @@ export async function processPdfToText(filePath: string): Promise { await new Promise((resolve) => setTimeout(resolve, 500)); // Wait for 0.5 seconds } } catch (error) { - console.error("Error fetching result:", error.data.detail || ''); + console.error("Error fetching result:", error || ''); attempt++; await new Promise((resolve) => setTimeout(resolve, 500)); // Wait for 0.5 seconds before retrying // You may want to handle specific errors differently