Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
anis committed Sep 16, 2024
1 parent 9344968 commit 0b909f9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/common/src/titres.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,51 @@ describe('getMostRecentValuePropFromEtapeFondamentaleValide', () => {
])
).toStrictEqual(dpu.fondamentale.titulaireIds)
})

test("retourne null s'il n'y a aucune étape fondamentale", () => {
expect(getMostRecentValuePropFromEtapeFondamentaleValide('titulaireIds', [])).toBe(null)
})

test('ignore une étape si sa propriété est null', () => {
const dpu: TitrePropTitreEtapeFindDemarcheEtape = {
etape_type_id: 'dpu',
fondamentale: {
date_debut: null,
date_fin: toCaminoDate('2032-08-18'),
duree: null,
substances: [],
titulaireIds: [entrepriseIdValidator.parse('fr-791652399')],
amodiataireIds: null,
perimetre: null,
},
etape_statut_id: 'acc',
is_brouillon: ETAPE_IS_NOT_BROUILLON,
ordre: 2,
}

const dex: TitrePropTitreEtapeFindDemarcheEtape = {
etape_type_id: 'dex',
fondamentale: {
date_debut: null,
date_fin: null,
duree: 240,
substances: [],
titulaireIds: [entrepriseIdValidator.parse('fr-310380811')],
amodiataireIds: null,
perimetre: null,
},
etape_statut_id: 'acc',
is_brouillon: ETAPE_IS_NOT_BROUILLON,
ordre: 1,
}

expect(
getMostRecentValuePropFromEtapeFondamentaleValide('duree', [
{
etapes: [dpu, dex],
ordre: 1,
},
])
).toStrictEqual(240)
})
})

0 comments on commit 0b909f9

Please sign in to comment.