getting back the cancel test, this should work
This commit is contained in:
parent
def2ba9987
commit
df3a678cf4
@ -811,52 +811,52 @@ describe("E2E Tests for API Routes", () => {
|
|||||||
expect(completedResponse.body.data.length).toBeGreaterThan(onlyChildrenLinks.length);
|
expect(completedResponse.body.data.length).toBeGreaterThan(onlyChildrenLinks.length);
|
||||||
}, 60000);
|
}, 60000);
|
||||||
|
|
||||||
// it.concurrent("If someone cancels a crawl job, it should turn into failed status", async () => {
|
it.concurrent("If someone cancels a crawl job, it should turn into failed status", async () => {
|
||||||
// const crawlResponse = await request(TEST_URL)
|
const crawlResponse = await request(TEST_URL)
|
||||||
// .post("/v0/crawl")
|
.post("/v0/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://scrapethissite.com" });
|
.send({ url: "https://scrapethissite.com" });
|
||||||
|
|
||||||
// expect(crawlResponse.statusCode).toBe(200);
|
expect(crawlResponse.statusCode).toBe(200);
|
||||||
|
|
||||||
// await new Promise((r) => setTimeout(r, 2000)); // Wait for 1 seconds before cancelling the job
|
await new Promise((r) => setTimeout(r, 2000)); // Wait for 1 seconds before cancelling the job
|
||||||
|
|
||||||
// const responseCancel = await request(TEST_URL)
|
const responseCancel = await request(TEST_URL)
|
||||||
// .delete(`/v0/crawl/cancel/${crawlResponse.body.jobId}`)
|
.delete(`/v0/crawl/cancel/${crawlResponse.body.jobId}`)
|
||||||
// .set("Authorization", `Bearer ${process.env.TEST_API_KEY}`);
|
.set("Authorization", `Bearer ${process.env.TEST_API_KEY}`);
|
||||||
// expect(responseCancel.statusCode).toBe(200);
|
expect(responseCancel.statusCode).toBe(200);
|
||||||
|
|
||||||
// let isFinished = false;
|
let isFinished = false;
|
||||||
// let completedResponse;
|
let completedResponse;
|
||||||
|
|
||||||
// while (!isFinished) {
|
while (!isFinished) {
|
||||||
// const response = await request(TEST_URL)
|
const response = 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(response.statusCode).toBe(200);
|
||||||
// expect(response.body).toHaveProperty("status");
|
expect(response.body).toHaveProperty("status");
|
||||||
// console.log(response.body.status)
|
console.log(response.body.status)
|
||||||
|
|
||||||
// if (response.body.status === "failed") {
|
if (response.body.status === "failed") {
|
||||||
// isFinished = true;
|
isFinished = true;
|
||||||
// completedResponse = response;
|
completedResponse = response;
|
||||||
// } else {
|
} else {
|
||||||
// await new Promise((r) => setTimeout(r, 1000)); // Wait for 1 second before checking again
|
await new Promise((r) => setTimeout(r, 1000)); // Wait for 1 second before checking again
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// expect(completedResponse.statusCode).toBe(200);
|
expect(completedResponse.statusCode).toBe(200);
|
||||||
// expect(completedResponse.body).toHaveProperty("status");
|
expect(completedResponse.body).toHaveProperty("status");
|
||||||
// expect(completedResponse.body.status).toBe("failed");
|
expect(completedResponse.body.status).toBe("failed");
|
||||||
// expect(completedResponse.body).toHaveProperty("data");
|
expect(completedResponse.body).toHaveProperty("data");
|
||||||
// expect(completedResponse.body.data).toBeNull();
|
expect(completedResponse.body.data).toBeNull();
|
||||||
// expect(completedResponse.body).toHaveProperty("partial_data");
|
expect(completedResponse.body).toHaveProperty("partial_data");
|
||||||
// expect(completedResponse.body.partial_data[0]).toHaveProperty("content");
|
expect(completedResponse.body.partial_data[0]).toHaveProperty("content");
|
||||||
// expect(completedResponse.body.partial_data[0]).toHaveProperty("markdown");
|
expect(completedResponse.body.partial_data[0]).toHaveProperty("markdown");
|
||||||
// expect(completedResponse.body.partial_data[0]).toHaveProperty("metadata");
|
expect(completedResponse.body.partial_data[0]).toHaveProperty("metadata");
|
||||||
|
|
||||||
// }, 60000); // 60 seconds
|
}, 60000); // 60 seconds
|
||||||
|
|
||||||
describe("POST /v0/scrape with LLM Extraction", () => {
|
describe("POST /v0/scrape with LLM Extraction", () => {
|
||||||
it.concurrent("should extract data using LLM extraction mode", async () => {
|
it.concurrent("should extract data using LLM extraction mode", async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user