]> juplo.de Git - demos/kafka/chat/commitdiff
refactor: pact-tests returns a promise
authorKai Moritz <kai@juplo.de>
Sat, 11 Oct 2025 11:18:18 +0000 (13:18 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 11 Oct 2025 12:46:02 +0000 (14:46 +0200)
src/app/chatroom/chatroom.service.pact.spec.ts

index 4fd4f117580e547208eee44ac337befba7510f56..511c1dedfd7fde400f77f4d8fa160bb031c50f50 100644 (file)
@@ -46,10 +46,19 @@ describe('Pact between the ChatroomService and the backend', () => {
         });
 
         const service = TestBed.inject(ChatroomService);
-        const chatrooms = await lastValueFrom(service.getChatrooms());
 
-        expect(chatrooms).toContainEqual(EXAMPLE_CHATROOM);
-        return chatrooms;
+        return new Promise<void>((resolve, reject) => {
+
+          service
+            .getChatrooms()
+            .subscribe({
+              next: (chatrooms) => {
+                expect(chatrooms).toContainEqual(EXAMPLE_CHATROOM);
+                resolve();
+              },
+              error: (error) => reject(error),
+            });
+        });
       });
   });
 });