Sync master into dev
This commit is contained in:
commit
890761e0d5
38 changed files with 17 additions and 16216 deletions
4
libs/core/cache/test/redis-cache.test.ts
vendored
4
libs/core/cache/test/redis-cache.test.ts
vendored
|
|
@ -2,7 +2,9 @@ import { beforeEach, describe, expect, it } from 'bun:test';
|
|||
import { RedisCache } from '../src/redis-cache';
|
||||
import type { CacheOptions } from '../src/types';
|
||||
|
||||
describe('RedisCache', () => {
|
||||
const hasTestRedis = Boolean(process.env.BACKTEST_TEST_REDIS_URL);
|
||||
|
||||
describe.skipIf(!hasTestRedis)('RedisCache', () => {
|
||||
let cache: RedisCache;
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ describe('Queue Utils', () => {
|
|||
process.env = originalEnv;
|
||||
});
|
||||
|
||||
it('should return test connection in test environment', () => {
|
||||
it('should preserve explicit endpoint in test environment', () => {
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
const config: RedisConfig = {
|
||||
|
|
@ -25,12 +25,12 @@ describe('Queue Utils', () => {
|
|||
|
||||
const connection = getRedisConnection(config);
|
||||
|
||||
expect(connection.host).toBe('localhost');
|
||||
expect(connection.port).toBe(6379);
|
||||
expect(connection.password).toBeUndefined();
|
||||
expect(connection.host).toBe('production.redis.com');
|
||||
expect(connection.port).toBe(6380);
|
||||
expect(connection.password).toBe('secret');
|
||||
});
|
||||
|
||||
it('should return test connection when BUNIT is set', () => {
|
||||
it('should preserve explicit endpoint when BUNIT is set', () => {
|
||||
process.env.BUNIT = '1';
|
||||
|
||||
const config: RedisConfig = {
|
||||
|
|
@ -40,8 +40,8 @@ describe('Queue Utils', () => {
|
|||
|
||||
const connection = getRedisConnection(config);
|
||||
|
||||
expect(connection.host).toBe('localhost');
|
||||
expect(connection.port).toBe(6379);
|
||||
expect(connection.host).toBe('production.redis.com');
|
||||
expect(connection.port).toBe(6380);
|
||||
});
|
||||
|
||||
it('should return actual config in non-test environment', () => {
|
||||
|
|
@ -66,7 +66,7 @@ describe('Queue Utils', () => {
|
|||
expect(connection.enableReadyCheck).toBe(false);
|
||||
expect(connection.connectTimeout).toBe(3000);
|
||||
expect(connection.lazyConnect).toBe(false);
|
||||
expect(connection.keepAlive).toBe(true);
|
||||
expect(connection.keepAlive).toBe(10000);
|
||||
expect(typeof connection.retryStrategy).toBe('function');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ describe('Shutdown Signal Handlers', () => {
|
|||
let shutdown: Shutdown;
|
||||
let processOnceSpy: any;
|
||||
let processExitSpy: any;
|
||||
const originalOnce = process.once;
|
||||
const originalOn = process.on;
|
||||
const originalExit = process.exit;
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset singleton instance
|
||||
(Shutdown as any).instance = null;
|
||||
|
||||
// Mock process.once to capture signal handlers
|
||||
// Mock process.on to capture signal handlers
|
||||
const listeners: Record<string, Function[]> = {};
|
||||
processOnceSpy = mock((event: string, handler: Function) => {
|
||||
if (!listeners[event]) {
|
||||
|
|
@ -21,7 +21,7 @@ describe('Shutdown Signal Handlers', () => {
|
|||
listeners[event].push(handler);
|
||||
return process;
|
||||
});
|
||||
process.once = processOnceSpy as any;
|
||||
process.on = processOnceSpy as any;
|
||||
|
||||
// Mock process.exit
|
||||
processExitSpy = mock((_code?: number) => {
|
||||
|
|
@ -36,7 +36,7 @@ describe('Shutdown Signal Handlers', () => {
|
|||
|
||||
afterEach(() => {
|
||||
// Restore original methods
|
||||
process.once = originalOnce;
|
||||
process.on = originalOn;
|
||||
process.exit = originalExit;
|
||||
|
||||
// Clean up
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue