This commit is contained in:
Boki 2025-06-25 11:38:23 -04:00
parent 3a7254708e
commit b63e58784c
41 changed files with 5762 additions and 4477 deletions

View file

@ -1,8 +1,8 @@
import { describe, expect, it } from 'bun:test';
import {
normalizeServiceName,
generateCachePrefix,
getFullQueueName,
normalizeServiceName,
parseQueueName,
} from '../src/service-utils';
@ -95,9 +95,9 @@ describe('Service Utils', () => {
const serviceName = 'userService';
const handlerName = 'processOrder';
const queueName = getFullQueueName(serviceName, handlerName);
expect(queueName).toBe('{user-service_processOrder}');
// Parse it back
const parsed = parseQueueName(queueName);
expect(parsed).toEqual({
@ -109,12 +109,12 @@ describe('Service Utils', () => {
it('should handle cache prefix generation', () => {
const serviceName = 'orderService';
const cachePrefix = generateCachePrefix(serviceName);
expect(cachePrefix).toBe('cache:order-service');
// Use it for cache keys
const cacheKey = `${cachePrefix}:user:123`;
expect(cacheKey).toBe('cache:order-service:user:123');
});
});
})
});