35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { FundamentalsAnalyst } from "../fundamentals";
|
|
import type { OpenRouterClient } from "../../lib/openrouter";
|
|
|
|
describe("FundamentalsAnalyst", () => {
|
|
it("should analyze company fundamentals", async () => {
|
|
const mockClient = {
|
|
createChatCompletion: async () => ({
|
|
choices: [
|
|
{
|
|
message: {
|
|
content:
|
|
'{"signal":"bullish","confidence":0.85,"reasoning":"Strong revenue growth"}',
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
} as unknown as OpenRouterClient;
|
|
|
|
const analyst = new FundamentalsAnalyst(mockClient);
|
|
const result = await analyst.analyze("AAPL", "Revenue: 100B, Profit: 20B");
|
|
|
|
expect(result.analyst).toBe("fundamentals");
|
|
expect(result.signal.signal).toBe("bullish");
|
|
});
|
|
|
|
it("should use specified model", () => {
|
|
const mockClient = {} as unknown as OpenRouterClient;
|
|
const analyst = new FundamentalsAnalyst(mockClient, {
|
|
model: "custom/model",
|
|
});
|
|
|
|
expect(analyst.getModel()).toBe("custom/model");
|
|
});
|
|
}); |