0

fixing jest parameters

This commit is contained in:
rafaelsideguide 2024-04-18 17:18:15 -03:00
parent dae024adc1
commit efbb4e8905
2 changed files with 13 additions and 12 deletions

View File

@ -51,7 +51,7 @@ jobs:
run: npm run workers & run: npm run workers &
working-directory: ./apps/api working-directory: ./apps/api
- name: Run E2E tests - name: Run E2E tests
run: npx jest --openHandlesTimeout=60000 -- src/__tests__/e2e/index.test.ts run: npx jest --openHandlesTimeout=60000 --watchAll=false -- src/__tests__/e2e/index.test.ts
working-directory: ./apps/api working-directory: ./apps/api

View File

@ -144,19 +144,20 @@ describe('E2E Tests for API Routes', () => {
expect(response.body).toHaveProperty('status'); expect(response.body).toHaveProperty('status');
expect(response.body.status).toBe('active'); expect(response.body.status).toBe('active');
setTimeout(async () => { // wait for 30 seconds
const response = await request(TEST_URL) await new Promise((r) => setTimeout(r, 30000));
const completedResponse = await request(TEST_URL)
.get(`/v0/crawl/status/${crawlResponse.body.jobId}`) .get(`/v0/crawl/status/${crawlResponse.body.jobId}`)
.set('Authorization', `Bearer ${process.env.TEST_API_KEY}`); .set('Authorization', `Bearer ${process.env.TEST_API_KEY}`);
expect(response.statusCode).toBe(200); expect(completedResponse.statusCode).toBe(200);
expect(response.body).toHaveProperty('status'); expect(completedResponse.body).toHaveProperty('status');
expect(response.body.status).toBe('completed'); expect(completedResponse.body.status).toBe('completed');
expect(response.body).toHaveProperty('data'); expect(completedResponse.body).toHaveProperty('data');
expect(response.body.data).toHaveProperty('content'); expect(completedResponse.body.data).toHaveProperty('content');
expect(response.body.data).toHaveProperty('markdown'); expect(completedResponse.body.data).toHaveProperty('markdown');
expect(response.body.data).toHaveProperty('metadata'); expect(completedResponse.body.data).toHaveProperty('metadata');
expect(response.body.data.content).toContain('🔥 FireCrawl'); expect(completedResponse.body.data.content).toContain('🔥 FireCrawl');
}, 30000); // 30 seconds
}, 60000); // 60 seconds }, 60000); // 60 seconds
}); });