From 85746f946491a78db054379d7877f1a26b369802 Mon Sep 17 00:00:00 2001 From: Henrik Meyer Date: Mon, 16 Dec 2024 11:27:18 +0100 Subject: [PATCH] Add test for coverage --- .../service-provider.repo.integration-spec.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/modules/service-provider/repo/service-provider.repo.integration-spec.ts b/src/modules/service-provider/repo/service-provider.repo.integration-spec.ts index 7134bdbe8..67edf47a9 100644 --- a/src/modules/service-provider/repo/service-provider.repo.integration-spec.ts +++ b/src/modules/service-provider/repo/service-provider.repo.integration-spec.ts @@ -203,6 +203,33 @@ describe('ServiceProviderRepo', () => { }); }); + describe('findByVidisAngebotId', () => { + it('should find a ServiceProvider by its VIDIS Angebot ID', async () => { + const expectedServiceProvider: ServiceProvider = DoFactory.createServiceProvider(false); + expectedServiceProvider.vidisAngebotId = '1234567'; + const expectedPersistedServiceProvider: ServiceProvider = await sut.save(expectedServiceProvider); + const anotherServiceProvider: ServiceProvider = DoFactory.createServiceProvider(false); + anotherServiceProvider.vidisAngebotId = '7777777'; + await sut.save(anotherServiceProvider); + + const actualServiceProvider: Option> = await sut.findByVidisAngebotId( + expectedServiceProvider.vidisAngebotId, + ); + + expect(actualServiceProvider).toEqual(expectedPersistedServiceProvider); + }); + + it('should return null if there are no existing ServiceProviders for the given VIDIS Angebot ID', async () => { + const serviceProvider: ServiceProvider = DoFactory.createServiceProvider(false); + serviceProvider.vidisAngebotId = '1234567'; + await sut.save(serviceProvider); + + const result: Option> = await sut.findByVidisAngebotId('7777777'); + + expect(result).toBeFalsy(); + }); + }); + describe('findByKeycloakGroup', () => { it('should find a ServiceProvider by its Keycloak groupname', async () => { const expectedServiceProvider: ServiceProvider = DoFactory.createServiceProvider(false);