]> juplo.de Git - demos/kafka/chat/commitdiff
feat: Shared refined pact with provider
authorKai Moritz <kai@juplo.de>
Sat, 11 Oct 2025 11:54:53 +0000 (13:54 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 11 Oct 2025 22:12:04 +0000 (00:12 +0200)
pacts
src/app/chatroom/chatroom.service.pact.spec.ts

diff --git a/pacts b/pacts
index b2bf161fa71acd4128b040ebb81af65fc1509cac..6ec14b0e50ab269edd0d0f9a98a4a3b167bffed3 160000 (submodule)
--- a/pacts
+++ b/pacts
@@ -1 +1 @@
-Subproject commit b2bf161fa71acd4128b040ebb81af65fc1509cac
+Subproject commit 6ec14b0e50ab269edd0d0f9a98a4a3b167bffed3
index 3eab0f0808d2d0a6188afa977bb7daed20c42863..34f64e1a3cdea7a2e781ff6db412e944e62b4f98 100644 (file)
@@ -1,6 +1,6 @@
 import { Matchers, Pact, SpecificationVersion } from '@pact-foundation/pact';
 import { TestBed } from '@angular/core/testing';
-import { HttpErrorResponse, provideHttpClient } from '@angular/common/http';
+import { provideHttpClient } from '@angular/common/http';
 import { lastValueFrom } from 'rxjs';
 import { ChatroomService } from './chatroom.service';
 import { Chatroom } from './chatroom.model';
@@ -33,7 +33,11 @@ describe('Pact between the ChatroomService and the backend', () => {
       .given('the server is responsible for shard 2')
       .given('chatroom 5c73531c-6fc4-426c-adcb-afc5c140a0f7 exists in shard 2')
       .uponReceiving('a request for /list')
-      .withRequest('GET', '/list')
+      .withRequest('GET', '/list', (builder) => {
+        builder.headers({
+          Accept: Matchers.like('application/json'),
+        });
+      })
       .willRespondWith(200, (builder) => {
         builder.headers({ 'Content-Type': 'application/json' });
         builder.jsonBody(Matchers.eachLike(EXAMPLE_CHATROOM));
@@ -62,7 +66,11 @@ describe('Pact between the ChatroomService and the backend', () => {
       .given('the server is responsible for shard 2')
       .given('there are no chatrooms available at all in shard 2')
       .uponReceiving('a request for /list')
-      .withRequest('GET', '/list')
+      .withRequest('GET', '/list', (builder) => {
+        builder.headers({
+          Accept: Matchers.like('application/json'),
+        });
+      })
       .willRespondWith(200, (builder) => {
         builder.headers({ 'Content-Type': 'application/json' });
         builder.jsonBody([]);
@@ -92,7 +100,10 @@ describe('Pact between the ChatroomService and the backend', () => {
       .given('chatroom 5c73531c-6fc4-426c-adcb-afc5c140a0f7 exists in shard 2')
       .uponReceiving('a request for /5c73531c-6fc4-426c-adcb-afc5c140a0f7')
       .withRequest('GET', '/5c73531c-6fc4-426c-adcb-afc5c140a0f7', (builder) => {
-        builder.headers({ 'X-Shard': 2 })
+        builder.headers({
+          Accept: Matchers.like('application/json'),
+          'X-Shard': 2,
+        });
       })
       .willRespondWith(200, (builder) => {
         builder.headers({ 'Content-Type': 'application/json' });
@@ -123,7 +134,10 @@ describe('Pact between the ChatroomService and the backend', () => {
       .given('chatroom 7f59ec77-832e-4a17-8d22-55ef46242c17 does not exists in shard 2')
       .uponReceiving('a request for /7f59ec77-832e-4a17-8d22-55ef46242c17')
       .withRequest('GET', '/7f59ec77-832e-4a17-8d22-55ef46242c17', (builder) => {
-        builder.headers({ 'X-Shard': 2 })
+        builder.headers({
+          Accept: Matchers.like('application/json'),
+          'X-Shard': 2,
+        });
       })
       .willRespondWith(404)
       .executeTest(async (mockserver) => {