refactor: pre-M0 cleanup, core library hardening, and isolated dev/QA Docker stack
- Remove ~44k LOC of dead code, legacy v1 TS simulator/strategy stack, event-bus, analytics FastAPI prototype, legacy calculation archives, and unused deps (data-ingestion provider API handlers untouched) - Extract @stock-bot/di/http-security and isolate @stock-bot/browser to data-ingestion via ServiceContainerBuilder.withRegistrations() - Harden @stock-bot/mongodb read-only proxies, flatten @stock-bot/postgres with unified master+research migrations, and fix @stock-bot/config EnvLoader, ServiceApplication worker lifecycle, NamespacedCache.clear(), and BatchProcessor error propagation - Flatten workspace root (remove apps/stock/package.json) and collapse orchestrator re-export shims - Pin all Docker image versions, add shm_size/nofile/RAM caps and docker-compose.quant.yml, fix 05-add-visible-column.sql view recreation, and decouple dev/QA Compose project names for side-by-side execution - Update PLATFORM-PLAN, DATA-CONTRACTS (bars_1m PARTITION BY MONTH, Rust bulk ETL, DuckDB limits), MILESTONES, and servers docs
This commit is contained in:
parent
ce9e2df67c
commit
4cd6038063
432 changed files with 1247 additions and 44469 deletions
|
|
@ -120,15 +120,17 @@ describe('Batch Processor', () => {
|
|||
throw new Error('Failed to add jobs');
|
||||
});
|
||||
|
||||
// processBatchJob should still complete even if addBulk fails
|
||||
const _result = await processBatchJob(
|
||||
batchData,
|
||||
'test-queue',
|
||||
mockQueueManager as unknown as QueueManager
|
||||
);
|
||||
// processBatchJob rethrows chunk errors and retains the cached payload for retry
|
||||
await expect(
|
||||
processBatchJob(
|
||||
batchData,
|
||||
'test-queue',
|
||||
mockQueueManager as unknown as QueueManager
|
||||
)
|
||||
).rejects.toThrow('Failed to add jobs');
|
||||
|
||||
expect(mockQueue.addBulk).toHaveBeenCalled();
|
||||
// The error is logged in addJobsInChunks, not in processBatchJob
|
||||
expect(mockCache.del).not.toHaveBeenCalled();
|
||||
expect(mockLogger.error).toHaveBeenCalledWith('Failed to add job chunk', expect.any(Object));
|
||||
});
|
||||
|
||||
|
|
@ -273,15 +275,15 @@ describe('Batch Processor', () => {
|
|||
throw new Error('Process error');
|
||||
});
|
||||
|
||||
// processItems catches errors and continues, so it won't reject
|
||||
const result = await processItems(
|
||||
items,
|
||||
'test-queue',
|
||||
options,
|
||||
mockQueueManager as unknown as QueueManager
|
||||
);
|
||||
await expect(
|
||||
processItems(
|
||||
items,
|
||||
'test-queue',
|
||||
options,
|
||||
mockQueueManager as unknown as QueueManager
|
||||
)
|
||||
).rejects.toThrow('Process error');
|
||||
|
||||
expect(result.jobsCreated).toBe(0);
|
||||
expect(mockQueue.addBulk).toHaveBeenCalled();
|
||||
expect(mockLogger.error).toHaveBeenCalledWith('Failed to add job chunk', expect.any(Object));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,278 +0,0 @@
|
|||
import type { Job, Queue } from 'bullmq';
|
||||
import { beforeEach, describe, expect, it, mock } from 'bun:test';
|
||||
import { DeadLetterQueueHandler } from '../src/dlq-handler';
|
||||
import type { RedisConfig } from '../src/types';
|
||||
|
||||
describe('DeadLetterQueueHandler', () => {
|
||||
// Mock the DLQ Queue that will be created
|
||||
const mockDLQQueue = {
|
||||
name: 'test-queue-dlq',
|
||||
add: mock(() => Promise.resolve({})),
|
||||
getCompleted: mock(() => Promise.resolve([])),
|
||||
getFailed: mock(() => Promise.resolve([])),
|
||||
getWaiting: mock(() => Promise.resolve([])),
|
||||
close: mock(() => Promise.resolve()),
|
||||
} as unknown as Queue;
|
||||
const mockLogger = {
|
||||
info: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
};
|
||||
|
||||
const mockQueue = {
|
||||
name: 'test-queue',
|
||||
add: mock(() => Promise.resolve({})),
|
||||
getCompleted: mock(() => Promise.resolve([])),
|
||||
getFailed: mock(() => Promise.resolve([])),
|
||||
getWaiting: mock(() => Promise.resolve([])),
|
||||
} as unknown as Queue;
|
||||
|
||||
const mockRedisConfig: RedisConfig = {
|
||||
host: 'localhost',
|
||||
port: 6379,
|
||||
};
|
||||
|
||||
let dlqHandler: DeadLetterQueueHandler;
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset DLQ queue mocks
|
||||
mockDLQQueue.add = mock(() => Promise.resolve({}));
|
||||
mockDLQQueue.getCompleted = mock(() => Promise.resolve([]));
|
||||
mockDLQQueue.getFailed = mock(() => Promise.resolve([]));
|
||||
mockDLQQueue.getWaiting = mock(() => Promise.resolve([]));
|
||||
mockDLQQueue.close = mock(() => Promise.resolve());
|
||||
|
||||
// Create handler with mocked DLQ queue
|
||||
dlqHandler = new DeadLetterQueueHandler(mockQueue, mockRedisConfig, {}, mockLogger);
|
||||
// Override the dlq property to use our mock
|
||||
(dlqHandler as any).dlq = mockDLQQueue;
|
||||
|
||||
// Reset mocks
|
||||
mockLogger.info = mock(() => {});
|
||||
mockLogger.error = mock(() => {});
|
||||
mockLogger.warn = mock(() => {});
|
||||
});
|
||||
|
||||
describe('handleFailedJob', () => {
|
||||
it('should log failed job details', async () => {
|
||||
const mockJob = {
|
||||
id: 'job-123',
|
||||
name: 'test-job',
|
||||
queueName: 'test-queue',
|
||||
data: {
|
||||
handler: 'testHandler',
|
||||
operation: 'testOp',
|
||||
payload: { test: true },
|
||||
},
|
||||
attemptsMade: 3,
|
||||
opts: { attempts: 3 },
|
||||
failedReason: 'Test error',
|
||||
finishedOn: Date.now(),
|
||||
processedOn: Date.now() - 5000,
|
||||
timestamp: Date.now() - 10000,
|
||||
} as Job;
|
||||
|
||||
const error = new Error('Job processing failed');
|
||||
|
||||
await dlqHandler.handleFailedJob(mockJob, error);
|
||||
|
||||
expect(mockLogger.error).toHaveBeenCalledWith(
|
||||
'Job moved to DLQ',
|
||||
expect.objectContaining({
|
||||
jobId: 'job-123',
|
||||
jobName: 'test-job',
|
||||
error: 'Job processing failed',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle jobs without data gracefully', async () => {
|
||||
const mockJob = {
|
||||
id: 'job-123',
|
||||
name: 'test-job',
|
||||
queueName: 'test-queue',
|
||||
data: null,
|
||||
attemptsMade: 3,
|
||||
opts: { attempts: 3 },
|
||||
timestamp: Date.now() - 10000,
|
||||
processedOn: Date.now() - 5000,
|
||||
} as any;
|
||||
|
||||
const error = new Error('No data');
|
||||
|
||||
await dlqHandler.handleFailedJob(mockJob, error);
|
||||
|
||||
expect(mockLogger.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should check alert threshold', async () => {
|
||||
const mockJob = {
|
||||
id: 'job-123',
|
||||
name: 'critical-job',
|
||||
queueName: 'critical-queue',
|
||||
data: { handler: 'critical', operation: 'process' },
|
||||
attemptsMade: 3,
|
||||
opts: { attempts: 3 },
|
||||
} as Job;
|
||||
|
||||
const error = new Error('Critical failure');
|
||||
|
||||
await dlqHandler.handleFailedJob(mockJob, error);
|
||||
|
||||
expect(mockLogger.warn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getStats', () => {
|
||||
it('should return DLQ statistics', async () => {
|
||||
const mockJobs = [
|
||||
{
|
||||
id: 'job-1',
|
||||
data: { originalJob: { name: 'process' } },
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 'job-2',
|
||||
data: { originalJob: { name: 'process' } },
|
||||
timestamp: Date.now() - 100000,
|
||||
},
|
||||
{
|
||||
id: 'job-3',
|
||||
data: { originalJob: { name: 'validate' } },
|
||||
timestamp: Date.now() - 200000,
|
||||
},
|
||||
];
|
||||
|
||||
mockDLQQueue.getCompleted = mock(() => Promise.resolve(mockJobs));
|
||||
mockDLQQueue.getFailed = mock(() => Promise.resolve([]));
|
||||
mockDLQQueue.getWaiting = mock(() => Promise.resolve([]));
|
||||
|
||||
const stats = await dlqHandler.getStats();
|
||||
|
||||
expect(stats.total).toBe(3);
|
||||
expect(stats.byJobName['process']).toBe(2);
|
||||
expect(stats.byJobName['validate']).toBe(1);
|
||||
expect(stats.oldestJob).toBeDefined();
|
||||
});
|
||||
|
||||
it('should handle empty DLQ', async () => {
|
||||
const stats = await dlqHandler.getStats();
|
||||
|
||||
expect(stats.total).toBe(0);
|
||||
expect(stats.byJobName).toEqual({});
|
||||
expect(stats.oldestJob).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('retryDLQJobs', () => {
|
||||
it('should retry jobs from DLQ', async () => {
|
||||
const mockDLQJobs = [
|
||||
{
|
||||
id: 'dlq-1',
|
||||
data: {
|
||||
originalJob: {
|
||||
id: 'orig-1',
|
||||
name: 'retry-job',
|
||||
data: { test: true },
|
||||
opts: {},
|
||||
},
|
||||
},
|
||||
remove: mock(() => Promise.resolve()),
|
||||
},
|
||||
];
|
||||
|
||||
(dlqHandler as any).dlq = {
|
||||
getCompleted: mock(() => Promise.resolve(mockDLQJobs)),
|
||||
};
|
||||
|
||||
const retriedCount = await dlqHandler.retryDLQJobs(1);
|
||||
|
||||
expect(retriedCount).toBe(1);
|
||||
expect(mockQueue.add).toHaveBeenCalledWith(
|
||||
'retry-job',
|
||||
{ test: true },
|
||||
expect.objectContaining({ delay: expect.any(Number) })
|
||||
);
|
||||
expect(mockDLQJobs[0].remove).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('cleanup', () => {
|
||||
it('should clean up old DLQ entries', async () => {
|
||||
const oldJob = {
|
||||
id: 'old-1',
|
||||
timestamp: Date.now() - 8 * 24 * 60 * 60 * 1000, // 8 days old
|
||||
remove: mock(() => Promise.resolve()),
|
||||
};
|
||||
|
||||
const newJob = {
|
||||
id: 'new-1',
|
||||
timestamp: Date.now() - 1 * 24 * 60 * 60 * 1000, // 1 day old
|
||||
remove: mock(() => Promise.resolve()),
|
||||
};
|
||||
|
||||
(dlqHandler as any).dlq = {
|
||||
getCompleted: mock(() => Promise.resolve([oldJob, newJob])),
|
||||
};
|
||||
|
||||
const removedCount = await dlqHandler.cleanup();
|
||||
|
||||
expect(removedCount).toBe(1);
|
||||
expect(oldJob.remove).toHaveBeenCalled();
|
||||
expect(newJob.remove).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('inspectFailedJobs', () => {
|
||||
it('should return formatted failed jobs', async () => {
|
||||
const mockDLQJobs = [
|
||||
{
|
||||
data: {
|
||||
originalJob: {
|
||||
id: 'orig-1',
|
||||
name: 'test-job',
|
||||
data: { test: true },
|
||||
attemptsMade: 3,
|
||||
},
|
||||
error: {
|
||||
message: 'Test error',
|
||||
stack: 'Error stack',
|
||||
},
|
||||
movedToDLQAt: '2024-01-01T00:00:00Z',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
(dlqHandler as any).dlq = {
|
||||
getCompleted: mock(() => Promise.resolve(mockDLQJobs)),
|
||||
};
|
||||
|
||||
const inspected = await dlqHandler.inspectFailedJobs(10);
|
||||
|
||||
expect(inspected).toHaveLength(1);
|
||||
expect(inspected[0]).toEqual({
|
||||
id: 'orig-1',
|
||||
name: 'test-job',
|
||||
data: { test: true },
|
||||
error: { message: 'Test error', stack: 'Error stack' },
|
||||
failedAt: '2024-01-01T00:00:00Z',
|
||||
attempts: 3,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('shutdown', () => {
|
||||
it('should close DLQ and clear state', async () => {
|
||||
const mockClose = mock(() => Promise.resolve());
|
||||
(dlqHandler as any).dlq = {
|
||||
close: mockClose,
|
||||
};
|
||||
|
||||
await dlqHandler.shutdown();
|
||||
|
||||
expect(mockClose).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
import type { Job, Queue, QueueEvents } from 'bullmq';
|
||||
import { beforeEach, describe, expect, it, mock, type Mock } from 'bun:test';
|
||||
import { QueueMetricsCollector } from '../src/queue-metrics';
|
||||
|
||||
describe('QueueMetricsCollector', () => {
|
||||
let metrics: QueueMetricsCollector;
|
||||
let mockQueue: {
|
||||
name: string;
|
||||
getWaitingCount: Mock<() => Promise<number>>;
|
||||
getActiveCount: Mock<() => Promise<number>>;
|
||||
getCompletedCount: Mock<() => Promise<number>>;
|
||||
getFailedCount: Mock<() => Promise<number>>;
|
||||
getDelayedCount: Mock<() => Promise<number>>;
|
||||
isPaused: Mock<() => Promise<boolean>>;
|
||||
getWaiting: Mock<() => Promise<Job[]>>;
|
||||
};
|
||||
let mockQueueEvents: {
|
||||
on: Mock<(event: string, handler: Function) => void>;
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
mockQueue = {
|
||||
name: 'test-queue',
|
||||
getWaitingCount: mock(() => Promise.resolve(0)),
|
||||
getActiveCount: mock(() => Promise.resolve(0)),
|
||||
getCompletedCount: mock(() => Promise.resolve(0)),
|
||||
getFailedCount: mock(() => Promise.resolve(0)),
|
||||
getDelayedCount: mock(() => Promise.resolve(0)),
|
||||
isPaused: mock(() => Promise.resolve(false)),
|
||||
getWaiting: mock(() => Promise.resolve([])),
|
||||
};
|
||||
|
||||
mockQueueEvents = {
|
||||
on: mock(() => {}),
|
||||
};
|
||||
|
||||
metrics = new QueueMetricsCollector(
|
||||
mockQueue as unknown as Queue,
|
||||
mockQueueEvents as unknown as QueueEvents
|
||||
);
|
||||
});
|
||||
|
||||
describe('collect metrics', () => {
|
||||
it('should collect current metrics', async () => {
|
||||
mockQueue.getWaitingCount.mockImplementation(() => Promise.resolve(5));
|
||||
mockQueue.getActiveCount.mockImplementation(() => Promise.resolve(2));
|
||||
mockQueue.getCompletedCount.mockImplementation(() => Promise.resolve(100));
|
||||
mockQueue.getFailedCount.mockImplementation(() => Promise.resolve(3));
|
||||
mockQueue.getDelayedCount.mockImplementation(() => Promise.resolve(1));
|
||||
|
||||
// Add some completed timestamps to avoid 100% failure rate
|
||||
const completedHandler = mockQueueEvents.on.mock.calls.find(
|
||||
call => call[0] === 'completed'
|
||||
)?.[1];
|
||||
if (completedHandler) {
|
||||
for (let i = 0; i < 50; i++) {
|
||||
completedHandler();
|
||||
}
|
||||
}
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.waiting).toBe(5);
|
||||
expect(result.active).toBe(2);
|
||||
expect(result.completed).toBe(100);
|
||||
expect(result.failed).toBe(3);
|
||||
expect(result.delayed).toBe(1);
|
||||
expect(result.isHealthy).toBe(true);
|
||||
});
|
||||
|
||||
it('should detect health issues', async () => {
|
||||
mockQueue.getWaitingCount.mockImplementation(() => Promise.resolve(2000)); // High backlog
|
||||
mockQueue.getActiveCount.mockImplementation(() => Promise.resolve(150)); // High active
|
||||
mockQueue.getFailedCount.mockImplementation(() => Promise.resolve(50));
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.isHealthy).toBe(false);
|
||||
expect(result.healthIssues.length).toBeGreaterThan(0);
|
||||
expect(result.healthIssues.some(issue => issue.includes('queue backlog'))).toBe(true);
|
||||
expect(result.healthIssues.some(issue => issue.includes('active jobs'))).toBe(true);
|
||||
});
|
||||
|
||||
it('should handle paused queue', async () => {
|
||||
mockQueue.getWaitingCount.mockImplementation(() => Promise.resolve(10));
|
||||
mockQueue.isPaused.mockImplementation(() => Promise.resolve(true));
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.paused).toBe(10);
|
||||
});
|
||||
});
|
||||
|
||||
describe('processing time metrics', () => {
|
||||
it('should calculate processing time metrics', async () => {
|
||||
// Access private property for testing
|
||||
const metricsWithPrivate = metrics as QueueMetricsCollector & {
|
||||
processingTimes: number[];
|
||||
};
|
||||
metricsWithPrivate.processingTimes = [1000, 2000, 3000, 4000, 5000];
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.processingTime.avg).toBe(3000);
|
||||
expect(result.processingTime.min).toBe(1000);
|
||||
expect(result.processingTime.max).toBe(5000);
|
||||
expect(result.processingTime.p95).toBe(5000);
|
||||
});
|
||||
|
||||
it('should handle no processing times', async () => {
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.processingTime.avg).toBe(0);
|
||||
expect(result.processingTime.min).toBe(0);
|
||||
expect(result.processingTime.max).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('throughput metrics', () => {
|
||||
it('should calculate throughput', async () => {
|
||||
// Access private properties for testing
|
||||
const metricsWithPrivate = metrics as QueueMetricsCollector & {
|
||||
completedTimestamps: number[];
|
||||
failedTimestamps: number[];
|
||||
};
|
||||
|
||||
const now = Date.now();
|
||||
metricsWithPrivate.completedTimestamps = [
|
||||
now - 30000, // 30 seconds ago
|
||||
now - 20000,
|
||||
now - 10000,
|
||||
];
|
||||
metricsWithPrivate.failedTimestamps = [now - 25000, now - 5000];
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.throughput.completedPerMinute).toBe(3);
|
||||
expect(result.throughput.failedPerMinute).toBe(2);
|
||||
expect(result.throughput.totalPerMinute).toBe(5);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getReport', () => {
|
||||
it('should generate formatted report', async () => {
|
||||
mockQueue.getWaitingCount.mockImplementation(() => Promise.resolve(5));
|
||||
mockQueue.getActiveCount.mockImplementation(() => Promise.resolve(2));
|
||||
mockQueue.getCompletedCount.mockImplementation(() => Promise.resolve(100));
|
||||
mockQueue.getFailedCount.mockImplementation(() => Promise.resolve(3));
|
||||
|
||||
// Add some completed timestamps to make it healthy
|
||||
const completedHandler = mockQueueEvents.on.mock.calls.find(
|
||||
call => call[0] === 'completed'
|
||||
)?.[1];
|
||||
if (completedHandler) {
|
||||
for (let i = 0; i < 50; i++) {
|
||||
completedHandler();
|
||||
}
|
||||
}
|
||||
|
||||
const report = await metrics.getReport();
|
||||
|
||||
expect(report).toContain('Queue Metrics Report');
|
||||
expect(report).toContain('✅ Healthy');
|
||||
expect(report).toContain('Waiting: 5');
|
||||
expect(report).toContain('Active: 2');
|
||||
expect(report).toContain('Completed: 100');
|
||||
expect(report).toContain('Failed: 3');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPrometheusMetrics', () => {
|
||||
it('should generate Prometheus formatted metrics', async () => {
|
||||
mockQueue.getWaitingCount.mockImplementation(() => Promise.resolve(5));
|
||||
mockQueue.getActiveCount.mockImplementation(() => Promise.resolve(2));
|
||||
mockQueue.getCompletedCount.mockImplementation(() => Promise.resolve(100));
|
||||
mockQueue.getFailedCount.mockImplementation(() => Promise.resolve(3));
|
||||
|
||||
const prometheusMetrics = await metrics.getPrometheusMetrics();
|
||||
|
||||
expect(prometheusMetrics).toContain('# HELP queue_jobs_total');
|
||||
expect(prometheusMetrics).toContain(
|
||||
'queue_jobs_total{queue="test-queue",status="waiting"} 5'
|
||||
);
|
||||
expect(prometheusMetrics).toContain('queue_jobs_total{queue="test-queue",status="active"} 2');
|
||||
expect(prometheusMetrics).toContain(
|
||||
'queue_jobs_total{queue="test-queue",status="completed"} 100'
|
||||
);
|
||||
expect(prometheusMetrics).toContain('# HELP queue_processing_time_seconds');
|
||||
expect(prometheusMetrics).toContain('# HELP queue_throughput_per_minute');
|
||||
expect(prometheusMetrics).toContain('# HELP queue_health');
|
||||
});
|
||||
});
|
||||
|
||||
describe('event listeners', () => {
|
||||
it('should setup event listeners on construction', () => {
|
||||
const newMockQueueEvents = {
|
||||
on: mock<(event: string, handler: Function) => void>(() => {}),
|
||||
};
|
||||
|
||||
new QueueMetricsCollector(
|
||||
mockQueue as unknown as Queue,
|
||||
newMockQueueEvents as unknown as QueueEvents
|
||||
);
|
||||
|
||||
expect(newMockQueueEvents.on).toHaveBeenCalledWith('completed', expect.any(Function));
|
||||
expect(newMockQueueEvents.on).toHaveBeenCalledWith('failed', expect.any(Function));
|
||||
expect(newMockQueueEvents.on).toHaveBeenCalledWith('active', expect.any(Function));
|
||||
});
|
||||
});
|
||||
|
||||
describe('oldest waiting job', () => {
|
||||
it('should get oldest waiting job date', async () => {
|
||||
const oldJob = {
|
||||
timestamp: Date.now() - 60000, // 1 minute ago
|
||||
} as Job;
|
||||
|
||||
mockQueue.getWaiting.mockImplementation(() => Promise.resolve([oldJob]));
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.oldestWaitingJob).toBeDefined();
|
||||
expect(result.oldestWaitingJob).toBeInstanceOf(Date);
|
||||
});
|
||||
|
||||
it('should return null when no waiting jobs', async () => {
|
||||
mockQueue.getWaiting.mockImplementation(() => Promise.resolve([]));
|
||||
|
||||
const result = await metrics.collect();
|
||||
|
||||
expect(result.oldestWaitingJob).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue