Skip to content

Commit

Permalink
Test av koden
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFjellstad committed Dec 18, 2024
1 parent 23d3819 commit 0295720
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions __tests__/validators/validerEndringAvMaanedslonn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,66 @@ describe.concurrent('valdiderEndringAvMaanedslonn', () => {
)
).toEqual([]);
});

it('should return error when harRefusjonEndringer is Ja and duplicated refusjonEndringer', () => {
const tid = new Date(2024, 5, 5);
expect(
valdiderEndringAvMaanedslonn(
'Ja',
[
{ dato: tid, beloep: 12345 },
{ dato: tid, beloep: 12345 }
],
undefined,
55500
)
).toEqual([
{
code: 'DUPLISERT_VALG_ENDRING_MAANEDSLONN_I_PERIODEN',
felt: 'refusjon.endringer'
}
]);
});

it('should return error when harRefusjonEndringer is Ja and duplicated refusjonEndringer dates', () => {
const tid = new Date(2024, 5, 5);
expect(
valdiderEndringAvMaanedslonn(
'Ja',
[
{ dato: tid, beloep: 12345 },
{ dato: tid, beloep: 1234 }
],
undefined,
55500
)
).toEqual([
{
code: 'DUPLISERT_DATO_VALG_ENDRING_MAANEDSLONN_I_PERIODEN',
felt: 'refusjon.endringer'
}
]);
});

it('should return error when harRefusjonEndringer is Ja and duplicated refusjonEndringer dates, even with a unique date in the mix', () => {
const tid = new Date(2024, 5, 5);
const tid2 = new Date(2024, 5, 6);
expect(
valdiderEndringAvMaanedslonn(
'Ja',
[
{ dato: tid, beloep: 12345 },
{ dato: tid, beloep: 1234 },
{ dato: tid2, beloep: 1234 }
],
undefined,
55500
)
).toEqual([
{
code: 'DUPLISERT_DATO_VALG_ENDRING_MAANEDSLONN_I_PERIODEN',
felt: 'refusjon.endringer'
}
]);
});
});

0 comments on commit 0295720

Please sign in to comment.