From: Kai Moritz Date: Sat, 11 Oct 2025 22:24:31 +0000 (+0200) Subject: refactor: Prepared for version V2 of `ChatroomService` X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9ac100450938d4a1413a5da5488c27c91a9bc5bc;p=demos%2Fkafka%2Fchat refactor: Prepared for version V2 of `ChatroomService` --- diff --git a/pacts b/pacts index 6ec14b0e..8c4e57bb 160000 --- a/pacts +++ b/pacts @@ -1 +1 @@ -Subproject commit 6ec14b0e50ab269edd0d0f9a98a4a3b167bffed3 +Subproject commit 8c4e57bb0973a60deb4d16b4e3ff13ba8a45989e diff --git a/src/app/chatroom/chatroom.service.pact.spec.ts b/src/app/chatroom/chatroom.service.pact.spec.ts index 34f64e1a..2d0b1566 100644 --- a/src/app/chatroom/chatroom.service.pact.spec.ts +++ b/src/app/chatroom/chatroom.service.pact.spec.ts @@ -25,72 +25,6 @@ describe('Pact between the ChatroomService and the backend', () => { }; - it('GET /list -- chatrooms available', async () => { - - await provider - .addInteraction() - .given('there are 10 shards') - .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', (builder) => { - builder.headers({ - Accept: Matchers.like('application/json'), - }); - }) - .willRespondWith(200, (builder) => { - builder.headers({ 'Content-Type': 'application/json' }); - builder.jsonBody(Matchers.eachLike(EXAMPLE_CHATROOM)); - }) - .executeTest(async (mockserver) => { - await TestBed.configureTestingModule({ - providers: [ - ChatroomService, - {provide: APP_PROPS, useValue: {backendUri: mockserver.url + '/'}}, - provideHttpClient(), - ] - }); - - const service = TestBed.inject(ChatroomService); - const chatrooms = await lastValueFrom(service.getChatrooms()); - - expect(chatrooms).toContainEqual(EXAMPLE_CHATROOM); - }); - }); - - it('GET /list -- no chatrooms available', async () => { - - await provider - .addInteraction() - .given('there are 10 shards') - .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', (builder) => { - builder.headers({ - Accept: Matchers.like('application/json'), - }); - }) - .willRespondWith(200, (builder) => { - builder.headers({ 'Content-Type': 'application/json' }); - builder.jsonBody([]); - }) - .executeTest(async (mockserver) => { - await TestBed.configureTestingModule({ - providers: [ - ChatroomService, - {provide: APP_PROPS, useValue: {backendUri: mockserver.url + '/'}}, - provideHttpClient(), - ] - }); - - const service = TestBed.inject(ChatroomService); - const chatrooms = await lastValueFrom(service.getChatrooms()); - - expect(chatrooms).toHaveLength(0); - }); - }); - it('GET /{CHATROOM-ID} -- existing chatroom, responsible shard', async () => { await provider