Skip to content

Commit

Permalink
fix: bug lorsque l'ancienneté arrive à 0 (#5714)
Browse files Browse the repository at this point in the history
* fix: bug lorsque l'ancienneté arrive à 0

* chore: clean

* chore: update test

---------

Co-authored-by: Victor <victor.zeinstra@gmail.com>
  • Loading branch information
Viczei and Victor committed Mar 27, 2024
1 parent 8e10ef2 commit 2e70765
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,28 @@ describe("Test de la fonctionnalité 'calculate'", () => {
"L’indemnité de licenciement n’est pas due lorsque l’ancienneté dans l’entreprise est inférieure à 8 mois."
);
});

test("Vérifier l'inéligibilité sur le bug des 2 mois", () => {
const { result, missingArgs, ineligibility } = engine.calculate({
absencePeriods:
'[{"motif":{"key":"absenceMaladieNonPro","label":"Absence pour maladie non professionnelle","value":1},"durationInMonth":2}]',
"contrat salarié . indemnité de licenciement . arrêt de travail": "non",
"contrat salarié . indemnité de licenciement . date d'entrée":
"01/01/2024",
"contrat salarié . indemnité de licenciement . date de notification":
"04/03/2024",
"contrat salarié . indemnité de licenciement . date de sortie":
"26/03/2024",
"contrat salarié . indemnité de licenciement . inaptitude suite à un accident ou maladie professionnelle":
"non",
licenciementFauteGrave: "non",
typeContratTravail: "cdi",
});
expect(missingArgs).toEqual([]);
expect(result.value).toEqual(0);
expect(ineligibility).toEqual(
"L’indemnité de licenciement n’est pas due lorsque l’ancienneté dans l’entreprise est inférieure à 8 mois."
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ class IndemniteLicenciementPublicodes
SupportedCcIndemniteLicenciement.default
);
const legalSeniority = legal.computeSeniority(legal.mapSituation(args));
if (legalSeniority.value) {
if (legalSeniority.value !== undefined) {
newArgs = {
...newArgs,
"contrat salarié . indemnité de licenciement . ancienneté en année":
legalSeniority.value.toString(),
...legalSeniority.extraInfos,
};
}
if (agreementSeniority.value) {
if (agreementSeniority.value !== undefined) {
newArgs = {
...newArgs,
"contrat salarié . indemnité de licenciement . ancienneté conventionnelle en année":
Expand All @@ -126,12 +126,12 @@ class IndemniteLicenciementPublicodes
const legalRequiredSeniority = legal.computeRequiredSeniority(
legal.mapRequiredSituation(args)
);
if (legalRequiredSeniority.value) {
if (legalRequiredSeniority.value !== undefined) {
newArgs[
"contrat salarié . indemnité de licenciement . ancienneté requise en année"
] = legalRequiredSeniority.value.toString();
}
if (agreementRequiredSeniority.value) {
if (agreementRequiredSeniority.value !== undefined) {
newArgs[
"contrat salarié . indemnité de licenciement . ancienneté conventionnelle requise en année"
] = agreementRequiredSeniority.value.toString();
Expand Down

0 comments on commit 2e70765

Please sign in to comment.