From 998643dc041db188a86376a8bed53be48093a63f Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 31 Mar 2025 19:55:56 -0700 Subject: [PATCH] add call to connect method in factory --- .../NotificationRepositorySharedTests.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/repositories/NotificationRepositorySharedTests.test.ts b/test/repositories/NotificationRepositorySharedTests.test.ts index 5216224..350ae53 100644 --- a/test/repositories/NotificationRepositorySharedTests.test.ts +++ b/test/repositories/NotificationRepositorySharedTests.test.ts @@ -6,19 +6,23 @@ import { RedisNotificationRepository } from "../../src/repositories/RedisNotific const repositoryImplementations = [ { name: 'InMemoryNotificationRepository', - factory: () => new InMemoryNotificationRepository(), + factory: async () => new InMemoryNotificationRepository(), }, { name: 'RedisNotificationRepository', - factory: () => new RedisNotificationRepository(), + factory: async () => { + const repo = new RedisNotificationRepository(); + await repo.connect(); + return repo; + }, }, ] describe.each(repositoryImplementations)('$name', ({ factory }) => { let repo: NotificationRepository; - beforeEach(() => { - repo = factory(); + beforeEach(async () => { + repo = await factory(); }); const notification = {