libs ready i think

This commit is contained in:
Boki 2025-06-21 19:15:58 -04:00
parent 1b34da9a69
commit 9673ae70ef
9 changed files with 242 additions and 129 deletions

View file

@ -88,6 +88,37 @@ describe('DI Library', () => {
expect(disposed).toBe(true);
});
test('OperationContext - enhanced functionality', () => {
const container = new ServiceContainer('test');
const context = OperationContext.create('test-handler', 'test-operation', {
container,
metadata: { userId: '123' },
});
expect(context).toBeDefined();
expect(context.logger).toBeDefined();
expect(context.traceId).toBeDefined();
expect(context.metadata.userId).toBe('123');
expect(context.getExecutionTime()).toBeGreaterThanOrEqual(0);
});
test('OperationContext - service resolution', () => {
const container = new ServiceContainer('test');
container.register({
name: 'testService',
factory: () => ({ value: 'resolved' }),
singleton: true,
});
const context = OperationContext.create('test-handler', 'test-operation', {
container,
});
const service = context.resolve<{ value: string }>('testService');
expect(service.value).toBe('resolved');
});
test('ConnectionFactory - creation', () => {
const factory = new ConnectionFactory({
service: 'test',