Files

37 lines
1.1 KiB
TypeScript

import { describe, it, expect, vi } from "vitest";
import { BullishResearcher, BearishResearcher } from "../researchers";
import type { AnalystReport } from "../../types/agents";
describe("Researchers", () => {
const mockClient = {
createChatCompletion: vi.fn().mockResolvedValue({
choices: [{ message: { content: "Bullish thesis content" } }],
}),
};
const mockReports: AnalystReport[] = [
{
analyst: "fundamentals",
report: "Strong earnings growth",
signal: {
agent: "fundamentals",
signal: "bullish",
confidence: 0.8,
reasoning: "Revenue up 20%",
timestamp: "2024-01-01",
},
},
];
it("should create bullish researcher", async () => {
const researcher = new BullishResearcher(mockClient as any);
const result = await researcher.research("AAPL", mockReports);
expect(result.researcher).toBe("bullish");
});
it("should create bearish researcher", async () => {
const researcher = new BearishResearcher(mockClient as any);
const result = await researcher.research("AAPL", mockReports);
expect(result.researcher).toBe("bearish");
});
});