Skip to content

Commit d3481a0

Browse files
committed
CCM-12438: coverage
1 parent f29bb4c commit d3481a0

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

lambdas/backend-api/src/__tests__/templates/app/routing-config-client.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,32 @@ describe('RoutingConfigClient', () => {
532532
});
533533
});
534534

535+
test('returns failures from client config repository', async () => {
536+
const { client, mocks } = setup();
537+
538+
mocks.clientConfigRepository.get.mockResolvedValueOnce({
539+
error: {
540+
errorMeta: {
541+
code: 500,
542+
description: 'could not fetch client config',
543+
},
544+
},
545+
});
546+
547+
const result = await client.submitRoutingConfig('some-id', user);
548+
549+
expect(mocks.routingConfigRepository.submit).not.toHaveBeenCalled();
550+
551+
expect(result).toEqual({
552+
error: {
553+
errorMeta: {
554+
code: 500,
555+
description: 'could not fetch client config',
556+
},
557+
},
558+
});
559+
});
560+
535561
test('returns failure if routing feature is disabled for the client', async () => {
536562
const { client, mocks } = setup();
537563

@@ -610,6 +636,32 @@ describe('RoutingConfigClient', () => {
610636
expect(result).toEqual(errorResponse);
611637
});
612638

639+
test('returns failures from client config repository', async () => {
640+
const { client, mocks } = setup();
641+
642+
mocks.clientConfigRepository.get.mockResolvedValueOnce({
643+
error: {
644+
errorMeta: {
645+
code: 500,
646+
description: 'could not fetch client config',
647+
},
648+
},
649+
});
650+
651+
const result = await client.deleteRoutingConfig('some-id', user);
652+
653+
expect(mocks.routingConfigRepository.delete).not.toHaveBeenCalled();
654+
655+
expect(result).toEqual({
656+
error: {
657+
errorMeta: {
658+
code: 500,
659+
description: 'could not fetch client config',
660+
},
661+
},
662+
});
663+
});
664+
613665
test('returns failure if routing feature is disabled for the client', async () => {
614666
const { client, mocks } = setup();
615667

0 commit comments

Comments
 (0)