0

Caleb: commented out massive test

This commit is contained in:
Caleb Peffer 2024-04-30 10:22:09 -07:00
parent a32f2b37b6
commit ad9c8e77d1

View File

@ -305,64 +305,64 @@ describe("E2E Tests for API Routes", () => {
}, 60000); // 60 secs }, 60000); // 60 secs
}); });
describe.only("POST /v0/scrape for Top 100 Companies", () => { // describe("POST /v0/scrape for Top 100 Companies", () => {
it("should extract data for the top 100 companies", async () => { // it("should extract data for the top 100 companies", async () => {
const response = await request(TEST_URL) // const response = await request(TEST_URL)
.post("/v0/scrape") // .post("/v0/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({ // .send({
url: "https://companiesmarketcap.com/", // url: "https://companiesmarketcap.com/",
pageOptions: { // pageOptions: {
onlyMainContent: true // onlyMainContent: true
}, // },
extractorOptions: { // extractorOptions: {
mode: "llm-extraction", // mode: "llm-extraction",
extractionPrompt: "Extract the name, market cap, price, and today's change for the top 20 companies listed on the page.", // extractionPrompt: "Extract the name, market cap, price, and today's change for the top 20 companies listed on the page.",
extractionSchema: { // extractionSchema: {
type: "object", // type: "object",
properties: { // properties: {
companies: { // companies: {
type: "array", // type: "array",
items: { // items: {
type: "object", // type: "object",
properties: { // properties: {
rank: { type: "number" }, // rank: { type: "number" },
name: { type: "string" }, // name: { type: "string" },
marketCap: { type: "string" }, // marketCap: { type: "string" },
price: { type: "string" }, // price: { type: "string" },
todayChange: { type: "string" } // todayChange: { type: "string" }
}, // },
required: ["rank", "name", "marketCap", "price", "todayChange"] // required: ["rank", "name", "marketCap", "price", "todayChange"]
} // }
} // }
}, // },
required: ["companies"] // required: ["companies"]
} // }
} // }
}); // });
// Print the response body to the console for debugging purposes // // Print the response body to the console for debugging purposes
console.log("Response companies:", response.body.data.llm_extraction.companies); // console.log("Response companies:", response.body.data.llm_extraction.companies);
// Check if the response has the correct structure and data types // // Check if the response has the correct structure and data types
expect(response.status).toBe(200); // expect(response.status).toBe(200);
expect(Array.isArray(response.body.data.llm_extraction.companies)).toBe(true); // expect(Array.isArray(response.body.data.llm_extraction.companies)).toBe(true);
expect(response.body.data.llm_extraction.companies.length).toBe(40); // expect(response.body.data.llm_extraction.companies.length).toBe(40);
// Sample check for the first company // // Sample check for the first company
const firstCompany = response.body.data.llm_extraction.companies[0]; // const firstCompany = response.body.data.llm_extraction.companies[0];
expect(firstCompany).toHaveProperty("name"); // expect(firstCompany).toHaveProperty("name");
expect(typeof firstCompany.name).toBe("string"); // expect(typeof firstCompany.name).toBe("string");
expect(firstCompany).toHaveProperty("marketCap"); // expect(firstCompany).toHaveProperty("marketCap");
expect(typeof firstCompany.marketCap).toBe("string"); // expect(typeof firstCompany.marketCap).toBe("string");
expect(firstCompany).toHaveProperty("price"); // expect(firstCompany).toHaveProperty("price");
expect(typeof firstCompany.price).toBe("string"); // expect(typeof firstCompany.price).toBe("string");
expect(firstCompany).toHaveProperty("todayChange"); // expect(firstCompany).toHaveProperty("todayChange");
expect(typeof firstCompany.todayChange).toBe("string"); // expect(typeof firstCompany.todayChange).toBe("string");
}, 120000); // 120 secs // }, 120000); // 120 secs
}); // });