T-10: M0.3b — Delete legacy MongoDB-writing sync-ib-exchanges operation and its web-api/web-app hooks
This commit is contained in:
parent
55629edb13
commit
b098bda462
1 changed files with 16 additions and 6 deletions
|
|
@ -96,9 +96,16 @@ describe('createJobHandler', () => {
|
|||
});
|
||||
|
||||
it('should support async operations', async () => {
|
||||
let resolveAsyncWork!: () => void;
|
||||
let asyncWorkCompleted = false;
|
||||
|
||||
const handler = createJobHandler<TestPayload, TestResult>(async job => {
|
||||
// Simulate async operation
|
||||
await new Promise(resolve => setTimeout(resolve, 10));
|
||||
await new Promise<void>(resolve => {
|
||||
resolveAsyncWork = () => {
|
||||
asyncWorkCompleted = true;
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
|
|
@ -120,12 +127,15 @@ describe('createJobHandler', () => {
|
|||
updateProgress: async () => {},
|
||||
};
|
||||
|
||||
const startTime = Date.now();
|
||||
const result = await handler(mockJob as any);
|
||||
const endTime = Date.now();
|
||||
const resultPromise = handler(mockJob as any);
|
||||
expect(asyncWorkCompleted).toBe(false);
|
||||
|
||||
resolveAsyncWork();
|
||||
const result = await resultPromise;
|
||||
|
||||
expect(asyncWorkCompleted).toBe(true);
|
||||
expect(result.success).toBe(true);
|
||||
expect(endTime - startTime).toBeGreaterThanOrEqual(10);
|
||||
expect(result.processedBy).toBe('user-789');
|
||||
});
|
||||
|
||||
it('should maintain type safety for complex payloads', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue