Skip to content

Commit

Permalink
Add test for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
he-meyer committed Dec 16, 2024
1 parent 3e5924e commit 85746f9
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,33 @@ describe('ServiceProviderRepo', () => {
});
});

describe('findByVidisAngebotId', () => {
it('should find a ServiceProvider by its VIDIS Angebot ID', async () => {
const expectedServiceProvider: ServiceProvider<false> = DoFactory.createServiceProvider(false);
expectedServiceProvider.vidisAngebotId = '1234567';
const expectedPersistedServiceProvider: ServiceProvider<true> = await sut.save(expectedServiceProvider);
const anotherServiceProvider: ServiceProvider<false> = DoFactory.createServiceProvider(false);
anotherServiceProvider.vidisAngebotId = '7777777';
await sut.save(anotherServiceProvider);

const actualServiceProvider: Option<ServiceProvider<true>> = 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<false> = DoFactory.createServiceProvider(false);
serviceProvider.vidisAngebotId = '1234567';
await sut.save(serviceProvider);

const result: Option<ServiceProvider<true>> = await sut.findByVidisAngebotId('7777777');

expect(result).toBeFalsy();
});
});

describe('findByKeycloakGroup', () => {
it('should find a ServiceProvider by its Keycloak groupname', async () => {
const expectedServiceProvider: ServiceProvider<false> = DoFactory.createServiceProvider(false);
Expand Down

0 comments on commit 85746f9

Please sign in to comment.