Skip to content

Commit

Permalink
Accept decosZaakTransformers as input in decosService functions
Browse files Browse the repository at this point in the history
  • Loading branch information
TvanWalen committed Dec 17, 2024
1 parent 4075ed0 commit 08008f7
Show file tree
Hide file tree
Showing 11 changed files with 633 additions and 611 deletions.
28 changes: 18 additions & 10 deletions src/server/services/decos/decos-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import uid from 'uid-safe';

import {
DecosDocumentSource,
DecosZaakSource,
DecosZakenResponse,
} from '../vergunningen-v2/config-and-types';
import {
fetchDecosDocumentList,
fetchDecosVergunningen,
fetchDecosZaken,
fetchDecosWorkflowDate,
fetchDecosZakenFromSource,
forTesting,
} from './decos-service';
import {
DecosDocumentSource,
DecosZaakSource,
DecosZakenResponse,
} from './decos-types';
import { remoteApi } from '../../../testing/utils';
import { jsonCopy, range } from '../../../universal/helpers/utils';
import { AuthProfileAndToken } from '../../auth/auth-types';
import { decosZaakTransformers } from '../vergunningen-v2/decos-zaken';

const zakenSource = {
count: 1,
Expand Down Expand Up @@ -321,9 +322,10 @@ describe('decos-service', () => {
.times(numberOfAddressBooksToSearch)
.replyWithError('Booksearch failed');

const responseData = await fetchDecosVergunningen(
const responseData = await fetchDecosZaken(
reqID,
authProfileAndToken
authProfileAndToken,
decosZaakTransformers
);

expect(responseData).toMatchInlineSnapshot(`
Expand All @@ -350,9 +352,10 @@ describe('decos-service', () => {
.times(numberOfAddressBooksToSearch)
.reply(200, zakenSource);

const responseData = await fetchDecosVergunningen(
const responseData = await fetchDecosZaken(
reqID,
authProfileAndToken
authProfileAndToken,
decosZaakTransformers
);

expect(responseData.status).toBe('OK');
Expand Down Expand Up @@ -598,6 +601,7 @@ describe('decos-service', () => {

const transformed = await forTesting.transformDecosZaakResponse(
reqID,
decosZaakTransformers,
zakenSource.content[0]
);

Expand Down Expand Up @@ -629,6 +633,7 @@ describe('decos-service', () => {

const transformed = await forTesting.transformDecosZaakResponse(
reqID,
decosZaakTransformers,
zaak
);
expect(transformed).toBe(null);
Expand All @@ -641,6 +646,7 @@ describe('decos-service', () => {

const transformed = await forTesting.transformDecosZaakResponse(
reqID,
decosZaakTransformers,
zaak
);
expect(transformed).not.toBe(null);
Expand All @@ -662,6 +668,7 @@ describe('decos-service', () => {

const transformed = await forTesting.transformDecosZaakResponse(
reqID,
decosZaakTransformers,
zaak
);
expect(transformed?.decision).toBe('Zie besluit');
Expand All @@ -682,6 +689,7 @@ describe('decos-service', () => {
});
const zakenTransformed = await forTesting.transformDecosZakenResponse(
reqID,
decosZaakTransformers,
zaken
);
expect(
Expand Down
Loading

0 comments on commit 08008f7

Please sign in to comment.