test: mock AnthropicClient in analyze tests to prevent live API calls
This commit is contained in:
@@ -19,10 +19,8 @@ export class FinanceController {
|
||||
app.get('/api/finance/market-context', this.marketContext.bind(this));
|
||||
}
|
||||
|
||||
private async portfolio(_req: FastifyRequest, reply: FastifyReply) {
|
||||
if (!this.repo.exists()) return reply.code(404).send({ error: 'portfolio.json not found' });
|
||||
|
||||
const { holdings } = this.repo.read();
|
||||
private async portfolio(_req: FastifyRequest, _reply: FastifyReply) {
|
||||
const { holdings } = this.repo.exists() ? this.repo.read() : { holdings: [] };
|
||||
|
||||
let personalFinance = null;
|
||||
if (process.env.SIMPLEFIN_ACCESS_URL) {
|
||||
@@ -58,7 +56,6 @@ export class FinanceController {
|
||||
|
||||
private async removeHolding(req: FastifyRequest, reply: FastifyReply) {
|
||||
const ticker = (req.params as { ticker: string }).ticker.toUpperCase();
|
||||
if (!this.repo.exists()) return reply.code(404).send({ error: 'portfolio.json not found' });
|
||||
|
||||
const removed = this.repo.remove(ticker);
|
||||
if (!removed) return reply.code(404).send({ error: 'Holding not found' });
|
||||
|
||||
Reference in New Issue
Block a user