-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(simulator): add new CC 2941 (#4166)
- Loading branch information
1 parent
70abb45
commit 8330d59
Showing
3 changed files
with
279 additions
and
1 deletion.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
...t__/2941-aide-accompagnement-soins-services-domicile/preavis-retraite/depart-mise.spec.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,84 @@ | ||
import Engine from "publicodes"; | ||
|
||
import { getNotifications } from "../../../index"; | ||
import { mergeModels } from "../../../internal/merger"; | ||
|
||
const engine = new Engine(mergeModels()); | ||
|
||
test.each` | ||
seniority | expectedNotice | ||
${1} | ${0} | ||
${6} | ${1} | ||
${24} | ${2} | ||
`( | ||
"Pour un employé possédant $seniority mois d'ancienneté, son préavis de départ à la retraite devrait être $expectedNotice mois", | ||
({ seniority, expectedNotice }) => { | ||
const situation = engine.setSituation({ | ||
"contrat salarié . ancienneté": seniority, | ||
"contrat salarié . convention collective": "'IDCC2941'", | ||
"contrat salarié . mise à la retraite": "non", | ||
"contrat salarié . travailleur handicapé": "non", | ||
}); | ||
const result = situation.evaluate("contrat salarié . préavis de retraite"); | ||
|
||
expect(result.nodeValue).toEqual(expectedNotice); | ||
expect(result.unit?.numerators).toEqual(["mois"]); | ||
expect(result.missingVariables).toEqual({}); | ||
|
||
expect(getNotifications(situation)).toHaveLength(0); | ||
} | ||
); | ||
|
||
test.each` | ||
seniority | category | expectedNotice | expectedUnit | expectedNotif | ||
${1} | ${"A, B, C ou D"} | ${7} | ${"jour"} | ${"1 semaine de date à date"} | ||
${6} | ${"A, B, C ou D"} | ${1} | ${"mois"} | ${"1 mois de date à date"} | ||
${25} | ${"A, B, C ou D"} | ${2} | ${"mois"} | ${"2 mois de date à date"} | ||
${1} | ${"E ou F"} | ${1} | ${"mois"} | ${"1 mois de date à date"} | ||
${6} | ${"E ou F"} | ${1} | ${"mois"} | ${"1 mois de date à date"} | ||
${24} | ${"E ou F"} | ${2} | ${"mois"} | ${"2 mois de date à date"} | ||
${25} | ${"E ou F"} | ${2} | ${"mois"} | ${"2 mois de date à date"} | ||
${1} | ${"G, H ou I"} | ${2} | ${"mois"} | ${"2 mois de date à date"} | ||
${6} | ${"G, H ou I"} | ${2} | ${"mois"} | ${"2 mois de date à date"} | ||
${24} | ${"G, H ou I"} | ${4} | ${"mois"} | ${"4 mois de date à date"} | ||
${25} | ${"G, H ou I"} | ${4} | ${"mois"} | ${"4 mois de date à date"} | ||
`( | ||
"Pour un employé de category $category possédant $seniority mois d'ancienneté, son préavis de mise à la retraite devrait être $expectedNotice mois", | ||
({ seniority, category, expectedNotice, expectedUnit, expectedNotif }) => { | ||
const situation = engine.setSituation({ | ||
"contrat salarié . ancienneté": seniority, | ||
"contrat salarié . convention collective": "'IDCC2941'", | ||
"contrat salarié . convention collective . bad . catégorie professionnelle": `'${category}'`, | ||
"contrat salarié . mise à la retraite": "oui", | ||
"contrat salarié . travailleur handicapé": "non", | ||
}); | ||
const result = situation.evaluate("contrat salarié . préavis de retraite"); | ||
const notifications = getNotifications(situation); | ||
|
||
expect(result.nodeValue).toEqual(expectedNotice); | ||
expect(result.unit?.numerators).toEqual([expectedUnit]); | ||
expect(result.missingVariables).toEqual({}); | ||
|
||
expect(notifications).toHaveLength(1); | ||
expect(notifications[0].description).toBe(expectedNotif); | ||
} | ||
); | ||
|
||
test("Pour un employé de category A, B, C ou D possédant 24 mois d'ancienneté, son préavis de mise à la retraite devrait être 2 mois mais il ne doit pas avoir de notif", () => { | ||
const situation = engine.setSituation({ | ||
"contrat salarié . ancienneté": 24, | ||
"contrat salarié . convention collective": "'IDCC2941'", | ||
"contrat salarié . convention collective . bad . catégorie professionnelle": | ||
"'A, B, C ou D'", | ||
"contrat salarié . mise à la retraite": "oui", | ||
"contrat salarié . travailleur handicapé": "non", | ||
}); | ||
const result = situation.evaluate("contrat salarié . préavis de retraite"); | ||
const notifications = getNotifications(situation); | ||
|
||
expect(result.nodeValue).toEqual(2); | ||
expect(result.unit?.numerators).toEqual(["mois"]); | ||
expect(result.missingVariables).toEqual({}); | ||
|
||
expect(notifications).toHaveLength(0); | ||
}); |
54 changes: 54 additions & 0 deletions
54
...st__/2941-aide-accompagnement-soins-services-domicile/preavis-retraite/references.spec.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,54 @@ | ||
import Engine from "publicodes"; | ||
|
||
import { mergeModels } from "../../../internal/merger"; | ||
import { getReferences } from "../../../utils/GetReferences"; | ||
import { | ||
DepartRetraiteReferences, | ||
MiseRetraiteReferences, | ||
} from "../../common/legal-references"; | ||
|
||
const engine = new Engine(mergeModels()); | ||
|
||
const MiseRetraiteReferencesBad = [ | ||
{ | ||
article: "Titre IV, article 26.1 et Titre IV, article 29", | ||
url: "https://www.legifrance.gouv.fr/conv_coll/id/KALIARTI000025805633/?idConteneur=KALICONT000025805800", | ||
}, | ||
].concat(MiseRetraiteReferences); | ||
test("Vérification des références juridiques pour un employéen en depart à la retraite", () => { | ||
const result = getReferences( | ||
engine.setSituation({ | ||
"contrat salarié . ancienneté": 6, | ||
"contrat salarié . convention collective": "'IDCC2941'", | ||
"contrat salarié . convention collective . bad . catégorie professionnelle": `'A, B, C ou D'`, | ||
"contrat salarié . mise à la retraite": "non", | ||
"contrat salarié . travailleur handicapé": "non", | ||
}) | ||
); | ||
|
||
expect(result).toHaveLength(DepartRetraiteReferences.length); | ||
expect(result).toEqual(expect.arrayContaining(DepartRetraiteReferences)); | ||
}); | ||
|
||
test.each` | ||
category | expectedReferences | ||
${"A, B, C ou D"} | ${MiseRetraiteReferencesBad} | ||
${"E ou F"} | ${MiseRetraiteReferencesBad} | ||
${"G, H ou I"} | ${MiseRetraiteReferencesBad} | ||
`( | ||
"Vérification des références juridiques pour un $category mise à la retraite", | ||
({ category, expectedReferences }) => { | ||
const result = getReferences( | ||
engine.setSituation({ | ||
"contrat salarié . ancienneté": 6, | ||
"contrat salarié . convention collective": "'IDCC2941'", | ||
"contrat salarié . convention collective . bad . catégorie professionnelle": `'${category}'`, | ||
"contrat salarié . mise à la retraite": "oui", | ||
"contrat salarié . travailleur handicapé": "non", | ||
}) | ||
); | ||
|
||
expect(result).toHaveLength(expectedReferences.length); | ||
expect(result).toEqual(expect.arrayContaining(expectedReferences)); | ||
} | ||
); |
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