15e49cb0f9
Run Tests / test (push) Failing after 8s
- Modified Alpaca Historical Bars tests to include range parameters in API requests. - Updated test descriptions for clarity. - Added cleanup step to delete test ticker after verification in stock database tests. - Adjusted Vitest configuration to exclude test files from coverage.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
|
|
test.describe("Alpaca Historical Bars", () => {
|
|
test("should return bars for AAPL with 1D timeframe and 1M range", async ({ page }) => {
|
|
const response = await page.request.get("/api/alpaca/quote/AAPL?range=1M");
|
|
expect(response.ok()).toBeTruthy();
|
|
|
|
const data = await response.json();
|
|
expect(data.ticker).toBe("AAPL");
|
|
expect(data.price).toBeGreaterThan(0);
|
|
expect(data.bars.length).toBeGreaterThan(0);
|
|
|
|
const bar = data.bars[0];
|
|
expect(bar.t).toBeDefined();
|
|
expect(bar.o).toBeGreaterThan(0);
|
|
expect(bar.h).toBeGreaterThan(0);
|
|
expect(bar.l).toBeGreaterThan(0);
|
|
expect(bar.c).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("should return bars for AAPL with 5Min timeframe and 1W range", async ({ page }) => {
|
|
const response = await page.request.get("/api/alpaca/quote/AAPL?timeframe=5Min&range=1W");
|
|
expect(response.ok()).toBeTruthy();
|
|
|
|
const data = await response.json();
|
|
expect(data.ticker).toBe("AAPL");
|
|
expect(data.bars.length).toBeGreaterThanOrEqual(0);
|
|
});
|
|
|
|
test("should return bars for AAPL with 1H timeframe and ALL range", async ({ page }) => {
|
|
const response = await page.request.get("/api/alpaca/quote/AAPL?timeframe=1H&range=ALL");
|
|
expect(response.ok()).toBeTruthy();
|
|
|
|
const data = await response.json();
|
|
expect(data.ticker).toBe("AAPL");
|
|
expect(data.bars.length).toBeGreaterThanOrEqual(0);
|
|
});
|
|
}); |