Extract shared calculations and preserve legacy research capabilities

This commit is contained in:
Boki 2026-10-21 20:27:07 -04:00
parent ccce401f72
commit 7827220b9b
82 changed files with 3099 additions and 1994 deletions

View file

@ -1,13 +1,15 @@
import { afterEach, beforeEach, describe, expect, it, mock } from 'bun:test';
import { fetch } from '../src/fetch';
import { fetch } from '@stock-bot/utils/fetch';
describe('Enhanced Fetch', () => {
let originalFetch: typeof globalThis.fetch;
let originalDebug: typeof console.debug;
let mockFetch: any;
let mockLogger: any;
beforeEach(() => {
originalFetch = globalThis.fetch;
originalDebug = console.debug;
mockFetch = mock(() => Promise.resolve(new Response('test')));
globalThis.fetch = mockFetch;
@ -20,6 +22,7 @@ describe('Enhanced Fetch', () => {
afterEach(() => {
globalThis.fetch = originalFetch;
console.debug = originalDebug;
});
describe('basic fetch', () => {
@ -209,8 +212,6 @@ describe('Enhanced Fetch', () => {
await fetch('https://api.example.com/data');
expect(consoleSpy).toHaveBeenCalledTimes(2); // Request and response
console.debug = originalFetch as any;
});
});