Skip to content

Commit

Permalink
Add tests for when no valid transformer is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
TvanWalen committed Dec 17, 2024
1 parent 08008f7 commit 2efbd66
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/server/services/decos/decos-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,8 @@ describe('decos-service', () => {
zaak
);
expect(transformed).not.toBe(null);
expect(transformed !== null && 'werkzaamheden' in transformed).toBe(true);
expect(
transformed !== null && 'werkzaamheden' in transformed
? transformed.werkzaamheden
: []
).toStrictEqual([
expect(transformed!).toHaveProperty('werkzaamheden');
expect((transformed as any).werkzaamheden).toStrictEqual([
'Werkzaamheden verrichten in de nacht',
'Verhuizing tussen twee locaties binnen Amsterdam',
]);
Expand All @@ -673,6 +669,16 @@ describe('decos-service', () => {
);
expect(transformed?.decision).toBe('Zie besluit');
});

test('Null response when no valid transformer', async () => {
const zaak: DecosZaakSource = jsonCopy(zakenSource.content[0]);
const transformed = await forTesting.transformDecosZaakResponse(
reqID,
[],
zaak
);
expect(transformed).toBe(null);
});
});

describe('transformDecosZakenResponse', () => {
Expand All @@ -696,5 +702,15 @@ describe('decos-service', () => {
zakenTransformed.map(({ identifier }) => identifier)
).toStrictEqual(['3 - xxx', '2 - xxx', '1 - xxx', '0 - xxx']);
});

test('Empty response when no valid transformer', async () => {
const zaak: DecosZaakSource = jsonCopy(zakenSource.content[0]);
const zakenTransformed = await forTesting.transformDecosZakenResponse(
reqID,
[],
[zaak]
);
expect(zakenTransformed).toStrictEqual([]);
});
});
});

0 comments on commit 2efbd66

Please sign in to comment.