]> juplo.de Git - demos/kafka/chat/commitdiff
refactor: switched back to simpler syntax with `lastValueFrom()`
authorKai Moritz <kai@juplo.de>
Sat, 11 Oct 2025 11:53:24 +0000 (13:53 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 11 Oct 2025 12:46:41 +0000 (14:46 +0200)
src/app/chatroom/chatroom.service.pact.spec.ts

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