Extract shared calculations and preserve legacy research capabilities
This commit is contained in:
parent
ccce401f72
commit
7827220b9b
82 changed files with 3099 additions and 1994 deletions
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue