T-16: M0.1b — Make repo-wide bun test green: fix queue, shutdown-signal and research-workflow test failures

This commit is contained in:
Studio 2026-11-27 12:01:06 -05:00
parent 890761e0d5
commit 9c4e87cdfd
17 changed files with 366 additions and 266 deletions

View file

@ -96,9 +96,15 @@ describe('createJobHandler', () => {
});
it('should support async operations', async () => {
let resolveStep!: () => void;
let asyncStepCompleted = false;
const stepGate = new Promise<void>(resolve => {
resolveStep = resolve;
});
const handler = createJobHandler<TestPayload, TestResult>(async job => {
// Simulate async operation
await new Promise(resolve => setTimeout(resolve, 10));
await stepGate;
asyncStepCompleted = true;
return {
success: true,
@ -120,12 +126,14 @@ describe('createJobHandler', () => {
updateProgress: async () => {},
};
const startTime = Date.now();
const result = await handler(mockJob as any);
const endTime = Date.now();
const pending = handler(mockJob as any);
expect(asyncStepCompleted).toBe(false);
resolveStep();
const result = await pending;
expect(asyncStepCompleted).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', () => {