add call to connect method in factory

This commit is contained in:
2025-03-31 19:55:56 -07:00
parent f34a2f27d7
commit 998643dc04

View File

@@ -6,19 +6,23 @@ import { RedisNotificationRepository } from "../../src/repositories/RedisNotific
const repositoryImplementations = [ const repositoryImplementations = [
{ {
name: 'InMemoryNotificationRepository', name: 'InMemoryNotificationRepository',
factory: () => new InMemoryNotificationRepository(), factory: async () => new InMemoryNotificationRepository(),
}, },
{ {
name: 'RedisNotificationRepository', name: 'RedisNotificationRepository',
factory: () => new RedisNotificationRepository(), factory: async () => {
const repo = new RedisNotificationRepository();
await repo.connect();
return repo;
},
}, },
] ]
describe.each(repositoryImplementations)('$name', ({ factory }) => { describe.each(repositoryImplementations)('$name', ({ factory }) => {
let repo: NotificationRepository; let repo: NotificationRepository;
beforeEach(() => { beforeEach(async () => {
repo = factory(); repo = await factory();
}); });
const notification = { const notification = {