This commit is contained in:
rafaelmmiller 2024-11-14 17:03:54 -03:00
parent 45091430ab
commit be5e6da5ff
2 changed files with 133 additions and 124 deletions

View File

@ -10,7 +10,6 @@ dotenv.config();
const TEST_URL = "http://127.0.0.1:3002";
describe("E2E Tests for Extract API Routes", () => {
describe("POST /v1/extract", () => {
it.concurrent("should return authors of blog posts on firecrawl.dev", async () => {
const response = await request(TEST_URL)
.post("/v1/extract")
@ -24,9 +23,11 @@ describe("E2E Tests for Extract API Routes", () => {
properties: { authors: { type: "array", items: { type: "string" } } },
},
});
console.log(response.body);
expect(response.statusCode).toBe(200);
expect(response.body).toHaveProperty("data");
expect(response.body.data).toHaveProperty("founders");
expect(response.body.data).toHaveProperty("authors");
let gotItRight = 0;
for (const author of response.body.data?.authors) {
@ -36,7 +37,7 @@ describe("E2E Tests for Extract API Routes", () => {
if (author.includes("Nicolas Camara")) gotItRight++;
}
expect(gotItRight).toBeGreaterThan(3);
expect(gotItRight).toBeGreaterThan(1);
}, 60000);
it.concurrent("should return founders of firecrawl.dev (allowExternalLinks = true)", async () => {
@ -147,5 +148,4 @@ describe("E2E Tests for Extract API Routes", () => {
// expect(response.body).toHaveProperty("data");
// expect(response.body.data?.pciDssCompliance).toBe(true);
}, 60000);
});
});

View File

@ -106,6 +106,15 @@ export interface FirecrawlCrawlStatusResponse {
error?: string;
}
export interface FirecrawlExtractResponse {
statusCode: number;
body: {
success: boolean;
data: any[];
};
error?: string;
}
export enum RateLimiterMode {
Crawl = "crawl",
CrawlStatus = "crawlStatus",