Nick:
This commit is contained in:
@@ -333,23 +333,23 @@ describe("E2E Tests for v1 API Routes", () => {
|
|||||||
// expect(response.body.data.metadata.statusCode).toBe(405);
|
// expect(response.body.data.metadata.statusCode).toBe(405);
|
||||||
// }, 60000);
|
// }, 60000);
|
||||||
|
|
||||||
it.concurrent('should return a successful response for a scrape with 500 page', async () => {
|
// it.concurrent('should return a successful response for a scrape with 500 page', async () => {
|
||||||
const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
// const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
||||||
.post('/v1/scrape')
|
// .post('/v1/scrape')
|
||||||
.set('Authorization', `Bearer ${process.env.TEST_API_KEY}`)
|
// .set('Authorization', `Bearer ${process.env.TEST_API_KEY}`)
|
||||||
.set('Content-Type', 'application/json')
|
// .set('Content-Type', 'application/json')
|
||||||
.send({ url: 'https://httpstat.us/500' });
|
// .send({ url: 'https://httpstat.us/500' });
|
||||||
await new Promise((r) => setTimeout(r, 5000));
|
// await new Promise((r) => setTimeout(r, 5000));
|
||||||
|
|
||||||
expect(response.statusCode).toBe(200);
|
// expect(response.statusCode).toBe(200);
|
||||||
expect(response.body).toHaveProperty('data');
|
// expect(response.body).toHaveProperty('data');
|
||||||
if (!("data" in response.body)) {
|
// if (!("data" in response.body)) {
|
||||||
throw new Error("Expected response body to have 'data' property");
|
// throw new Error("Expected response body to have 'data' property");
|
||||||
}
|
// }
|
||||||
expect(response.body.data).toHaveProperty('markdown');
|
// expect(response.body.data).toHaveProperty('markdown');
|
||||||
expect(response.body.data).toHaveProperty('metadata');
|
// expect(response.body.data).toHaveProperty('metadata');
|
||||||
expect(response.body.data.metadata.statusCode).toBe(500);
|
// expect(response.body.data.metadata.statusCode).toBe(500);
|
||||||
}, 60000);
|
// }, 60000);
|
||||||
|
|
||||||
it.concurrent("should return a timeout error when scraping takes longer than the specified timeout", async () => {
|
it.concurrent("should return a timeout error when scraping takes longer than the specified timeout", async () => {
|
||||||
const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
||||||
@@ -681,7 +681,7 @@ describe("POST /v1/crawl", () => {
|
|||||||
.set("Content-Type", "application/json")
|
.set("Content-Type", "application/json")
|
||||||
.send({
|
.send({
|
||||||
url: "https://firecrawl.dev",
|
url: "https://firecrawl.dev",
|
||||||
limit: 20,
|
limit: 40,
|
||||||
includePaths: ["blog/*"],
|
includePaths: ["blog/*"],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ describe("POST /v1/crawl", () => {
|
|||||||
.set("Content-Type", "application/json")
|
.set("Content-Type", "application/json")
|
||||||
.send({
|
.send({
|
||||||
url: "https://firecrawl.dev",
|
url: "https://firecrawl.dev",
|
||||||
limit: 20,
|
limit: 40,
|
||||||
excludePaths: ["blog/*"],
|
excludePaths: ["blog/*"],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -929,11 +929,11 @@ describe("GET /v1/crawl/:jobId", () => {
|
|||||||
.post("/v1/crawl")
|
.post("/v1/crawl")
|
||||||
.set("Authorization", `Bearer ${process.env.TEST_API_KEY}`)
|
.set("Authorization", `Bearer ${process.env.TEST_API_KEY}`)
|
||||||
.set("Content-Type", "application/json")
|
.set("Content-Type", "application/json")
|
||||||
.send({ url: "https://docs.tatum.io", limit: 200 });
|
.send({ url: "https://docs.firecrawl.dev", limit: 10 });
|
||||||
|
|
||||||
expect(crawlResponse.statusCode).toBe(200);
|
expect(crawlResponse.statusCode).toBe(200);
|
||||||
|
|
||||||
await new Promise((r) => setTimeout(r, 5000));
|
await new Promise((r) => setTimeout(r, 10000));
|
||||||
|
|
||||||
const responseCancel = await request(TEST_URL)
|
const responseCancel = await request(TEST_URL)
|
||||||
.delete(`/v1/crawl/${crawlResponse.body.id}`)
|
.delete(`/v1/crawl/${crawlResponse.body.id}`)
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ export async function scrapSingleUrl(
|
|||||||
Logger.debug(`⛏️ ${scraper}: Successfully scraped ${urlToScrap} with text length >= 100 or screenshot, breaking`);
|
Logger.debug(`⛏️ ${scraper}: Successfully scraped ${urlToScrap} with text length >= 100 or screenshot, breaking`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pageStatusCode && (pageStatusCode == 404 || pageStatusCode == 400)) {
|
if (pageStatusCode && (pageStatusCode == 404 || pageStatusCode == 400 || pageStatusCode == 401)) {
|
||||||
Logger.debug(`⛏️ ${scraper}: Successfully scraped ${urlToScrap} with status code ${pageStatusCode}, breaking`);
|
Logger.debug(`⛏️ ${scraper}: Successfully scraped ${urlToScrap} with status code ${pageStatusCode}, breaking`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user