-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(indemnite-licenciement): ajout de log + tests sur les années (#5798)
* fix: tu * fix(e2e): set number of idcc for h2 in contributions * fix: test * fix: disable other
- Loading branch information
Showing
10 changed files
with
133 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
packages/code-du-travail-frontend/src/outils/publicodes/indemnite-licenciement.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/code-du-travail-modeles/src/__test__/common/transform-to-situation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export interface ISituationItem { | ||
name: string; | ||
value: number | string; | ||
rawNode: { | ||
nom: string; | ||
valeur?: number | string; | ||
titre?: string; | ||
unité?: string; | ||
}; | ||
} | ||
|
||
export function generateSituation( | ||
situation: ISituationItem[] | ||
): Record<string, string | undefined> { | ||
const output: Record<string, string | undefined> = {}; | ||
situation.forEach((item) => { | ||
output[item.name] = item.value.toString(); | ||
}); | ||
return output; | ||
} |
97 changes: 97 additions & 0 deletions
97
packages/code-du-travail-modeles/src/publicodes/__tests__/SentryOutputHelper.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { generateSituation } from "../../__test__/common/transform-to-situation"; | ||
import { mergeIndemniteLicenciementModels } from "../../internal/merger"; | ||
import IndemniteLicenciementPublicodes from "../IndemniteLicenciementPublicodes"; | ||
|
||
const situationAvecDate = [ | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . date d'entrée", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . date d'entrée", | ||
valeur: "01/01/2024", | ||
}, | ||
value: "01/10/12", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . date de notification", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . date de notification", | ||
valeur: "01/01/2024", | ||
}, | ||
value: "21/02/24", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . date de sortie", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . date de sortie", | ||
valeur: "non", | ||
}, | ||
value: "13/03/24", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . inaptitude suite à un accident ou maladie professionnelle", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . inaptitude suite à un accident ou maladie professionnelle", | ||
valeur: "non", | ||
}, | ||
value: "non", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . arrêt de travail", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . arrêt de travail", | ||
valeur: "non", | ||
}, | ||
value: "oui", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . ancienneté en année", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . ancienneté en année", | ||
titre: | ||
"Ancienneté calculée pour le calcul de l'indemnité de licenciement", | ||
unité: "an", | ||
}, | ||
value: "2011.4166666666667", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . ancienneté conventionnelle en année", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . ancienneté conventionnelle en année", | ||
titre: | ||
"Ancienneté calculée pour le calcul de l'indemnité de licenciement conventionnelle", | ||
unité: "an", | ||
}, | ||
value: "2011.4166666666667", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . ancienneté requise en année", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . ancienneté requise en année", | ||
titre: "Ancienneté calculée pour le droit à l'indemnité de licenciement", | ||
unité: "an", | ||
}, | ||
value: "2011.3333333333333", | ||
}, | ||
{ | ||
name: "contrat salarié . indemnité de licenciement . ancienneté conventionnelle requise en année", | ||
rawNode: { | ||
nom: "contrat salarié . indemnité de licenciement . ancienneté conventionnelle requise en année", | ||
titre: | ||
"Ancienneté calculée pour le droit à l'indemnité de licenciement conventionnelle", | ||
unité: "an", | ||
}, | ||
value: "2011.3333333333333", | ||
}, | ||
]; // Ça doit failed car la date n'a que deux digits | ||
|
||
describe("Classe qui permet de débugguer les console.error issues de Sentry", () => { | ||
const publicodes = new IndemniteLicenciementPublicodes( | ||
mergeIndemniteLicenciementModels() | ||
); | ||
|
||
it.each([[situationAvecDate]])("doit failed", (situation) => { | ||
expect(() => { | ||
publicodes.setSituation(generateSituation(situation)); | ||
}).toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters