tests
This commit is contained in:
parent
3a7254708e
commit
b63e58784c
41 changed files with 5762 additions and 4477 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, it, mock, beforeEach } from 'bun:test';
|
||||
import { ServiceLifecycleManager } from '../src/utils/lifecycle';
|
||||
import type { AwilixContainer } from 'awilix';
|
||||
import { beforeEach, describe, expect, it, mock } from 'bun:test';
|
||||
import { ServiceLifecycleManager } from '../src/utils/lifecycle';
|
||||
|
||||
describe('ServiceLifecycleManager', () => {
|
||||
let manager: ServiceLifecycleManager;
|
||||
|
|
@ -14,7 +14,7 @@ describe('ServiceLifecycleManager', () => {
|
|||
const mockCache = {
|
||||
connect: mock(() => Promise.resolve()),
|
||||
};
|
||||
|
||||
|
||||
const mockMongoClient = {
|
||||
connect: mock(() => Promise.resolve()),
|
||||
};
|
||||
|
|
@ -74,7 +74,9 @@ describe('ServiceLifecycleManager', () => {
|
|||
},
|
||||
} as unknown as AwilixContainer;
|
||||
|
||||
await expect(manager.initializeServices(mockContainer, 100)).rejects.toThrow('cache initialization timed out after 100ms');
|
||||
await expect(manager.initializeServices(mockContainer, 100)).rejects.toThrow(
|
||||
'cache initialization timed out after 100ms'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -83,7 +85,7 @@ describe('ServiceLifecycleManager', () => {
|
|||
const mockCache = {
|
||||
disconnect: mock(() => Promise.resolve()),
|
||||
};
|
||||
|
||||
|
||||
const mockMongoClient = {
|
||||
disconnect: mock(() => Promise.resolve()),
|
||||
};
|
||||
|
|
@ -150,14 +152,14 @@ describe('ServiceLifecycleManager', () => {
|
|||
|
||||
it('should shutdown services in reverse order', async () => {
|
||||
const callOrder: string[] = [];
|
||||
|
||||
|
||||
const mockCache = {
|
||||
disconnect: mock(() => {
|
||||
callOrder.push('cache');
|
||||
return Promise.resolve();
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
const mockQueueManager = {
|
||||
close: mock(() => {
|
||||
callOrder.push('queue');
|
||||
|
|
@ -257,4 +259,4 @@ describe('ServiceLifecycleManager', () => {
|
|||
expect(mockQuestdbClient.shutdown).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue