mirror of
https://github.com/mendableai/firecrawl.git
synced 2025-12-08 13:30:07 +00:00
Update index.test.ts
This commit is contained in:
parent
49bd95327e
commit
82551bb6bc
@ -278,23 +278,24 @@ describe("E2E Tests for v1 API Routes", () => {
|
|||||||
expect(response.body.data.metadata.statusCode).toBe(401);
|
expect(response.body.data.metadata.statusCode).toBe(401);
|
||||||
}, 60000);
|
}, 60000);
|
||||||
|
|
||||||
it.concurrent('should return a successful response for a scrape with 403 page', async () => {
|
// Removed it as we want to retry fallback to the next scraper
|
||||||
const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
// it.concurrent('should return a successful response for a scrape with 403 page', async () => {
|
||||||
.post('/v1/scrape')
|
// const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
||||||
.set('Authorization', `Bearer ${process.env.TEST_API_KEY}`)
|
// .post('/v1/scrape')
|
||||||
.set('Content-Type', 'application/json')
|
// .set('Authorization', `Bearer ${process.env.TEST_API_KEY}`)
|
||||||
.send({ url: 'https://httpstat.us/403' });
|
// .set('Content-Type', 'application/json')
|
||||||
await new Promise((r) => setTimeout(r, 5000));
|
// .send({ url: 'https://httpstat.us/403' });
|
||||||
|
// 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(403);
|
// expect(response.body.data.metadata.statusCode).toBe(403);
|
||||||
}, 60000);
|
// }, 60000);
|
||||||
|
|
||||||
it.concurrent('should return a successful response for a scrape with 404 page', async () => {
|
it.concurrent('should return a successful response for a scrape with 404 page', async () => {
|
||||||
const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
const response: ScrapeResponseRequestTest = await request(TEST_URL)
|
||||||
@ -314,23 +315,23 @@ describe("E2E Tests for v1 API Routes", () => {
|
|||||||
expect(response.body.data.metadata.statusCode).toBe(404);
|
expect(response.body.data.metadata.statusCode).toBe(404);
|
||||||
}, 60000);
|
}, 60000);
|
||||||
|
|
||||||
it.concurrent('should return a successful response for a scrape with 405 page', async () => {
|
// it.concurrent('should return a successful response for a scrape with 405 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/405' });
|
// .send({ url: 'https://httpstat.us/405' });
|
||||||
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(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)
|
||||||
@ -680,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: 10,
|
limit: 20,
|
||||||
includePaths: ["blog/*"],
|
includePaths: ["blog/*"],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -736,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: 10,
|
limit: 20,
|
||||||
excludePaths: ["blog/*"],
|
excludePaths: ["blog/*"],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -932,7 +933,7 @@ describe("GET /v1/crawl/:jobId", () => {
|
|||||||
|
|
||||||
expect(crawlResponse.statusCode).toBe(200);
|
expect(crawlResponse.statusCode).toBe(200);
|
||||||
|
|
||||||
await new Promise((r) => setTimeout(r, 10000));
|
await new Promise((r) => setTimeout(r, 5000));
|
||||||
|
|
||||||
const responseCancel = await request(TEST_URL)
|
const responseCancel = await request(TEST_URL)
|
||||||
.delete(`/v1/crawl/${crawlResponse.body.id}`)
|
.delete(`/v1/crawl/${crawlResponse.body.id}`)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user