created lots of tests
This commit is contained in:
parent
42baadae38
commit
54f37f9521
21 changed files with 4577 additions and 215 deletions
46
libs/core/di/test/factories.test.ts
Normal file
46
libs/core/di/test/factories.test.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { describe, expect, it } from 'bun:test';
|
||||
import { CacheFactory } from '../src/factories';
|
||||
|
||||
describe('DI Factories', () => {
|
||||
describe('CacheFactory', () => {
|
||||
it('should be exported', () => {
|
||||
expect(CacheFactory).toBeDefined();
|
||||
});
|
||||
|
||||
it('should create cache with configuration', () => {
|
||||
const cacheConfig = {
|
||||
redisConfig: {
|
||||
host: 'localhost',
|
||||
port: 6379,
|
||||
db: 1,
|
||||
},
|
||||
keyPrefix: 'test:',
|
||||
};
|
||||
|
||||
const cache = CacheFactory.create(cacheConfig);
|
||||
expect(cache).toBeDefined();
|
||||
});
|
||||
|
||||
it('should create null cache without config', () => {
|
||||
const cache = CacheFactory.create();
|
||||
expect(cache).toBeDefined();
|
||||
expect(cache.type).toBe('null');
|
||||
});
|
||||
|
||||
it('should create cache with logger', () => {
|
||||
const mockLogger = {
|
||||
info: () => {},
|
||||
error: () => {},
|
||||
warn: () => {},
|
||||
debug: () => {},
|
||||
};
|
||||
|
||||
const cacheConfig = {
|
||||
logger: mockLogger,
|
||||
};
|
||||
|
||||
const cache = CacheFactory.create(cacheConfig);
|
||||
expect(cache).toBeDefined();
|
||||
});
|
||||
});
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue