-
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: indemnite licenciement 1404 (#5133)
* feat: prendre referer au lieu de src_url * Revert "feat: prendre referer au lieu de src_url" This reverts commit 5516d3c. * feat: implement indemnite licenciement CC1404 * fix: affichage input mobile * chore: fix tests * fix: reviews * fix: seniority 1404 * chore: fix test * fix: missed copy * chore: snap * fix: wording + seniority * chore: review * fix: changement metier * fix: review * chore: update snap * feat: ajout des descriptions pour salaires * fix: cadre bleu qui ne s'affiche plus * fix: seniorirt * chore: snap * fix: test --------- Co-authored-by: Victor Zeinstra <[email protected]> Co-authored-by: Martial Maillot <[email protected]>
- Loading branch information
1 parent
c0226db
commit 5fa2153
Showing
26 changed files
with
1,246 additions
and
29 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
134 changes: 134 additions & 0 deletions
134
packages/code-du-travail-frontend/src/outils/IndemniteLicenciement/__tests__/cc1404.test.tsx
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,134 @@ | ||
import { render, fireEvent } from "@testing-library/react"; | ||
import React from "react"; | ||
import { CalculateurIndemnite } from "../../../../src/outils"; | ||
import { ui } from "./ui"; | ||
import userEvent from "@testing-library/user-event"; | ||
|
||
jest.spyOn(Storage.prototype, "setItem"); | ||
Storage.prototype.getItem = jest.fn( | ||
() => `{ | ||
"url":"https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635653", | ||
"id":"KALICONT000005635653", | ||
"num":1404, | ||
"shortTitle":"Entreprises de la maintenance, distribution et location de matériels agricoles, de travaux publics, de bâtiment, de manutention, de motoculture de plaisance et activités connexes, dite SDLM", | ||
"slug":"1404-entreprises-de-la-maintenance-distribution-et-location-de-materiels-agrico", | ||
"title":"Entreprises de la maintenance, distribution et location de matériels agricoles, de travaux publics, de bâtiment, de manutention, de motoculture de plaisance et activités connexes, dite SDLM" | ||
}` | ||
); | ||
|
||
describe("Indemnité licenciement - CC 1404", () => { | ||
beforeEach(() => { | ||
render( | ||
<CalculateurIndemnite | ||
icon={""} | ||
title={""} | ||
displayTitle={""} | ||
slug={"indemnite-licenciement"} | ||
/> | ||
); | ||
userEvent.click(ui.introduction.startButton.get()); | ||
userEvent.click(ui.contract.type.cdi.get()); | ||
userEvent.click(ui.contract.fauteGrave.non.get()); | ||
userEvent.click(ui.contract.inaptitude.non.get()); | ||
userEvent.click(ui.contract.arretTravail.non.get()); | ||
userEvent.click(ui.next.get()); | ||
userEvent.click(ui.next.get()); | ||
}); | ||
|
||
test("Vérifier que le CDI classique amène au résultat", () => { | ||
userEvent.click(ui.information.agreement1404.cdiOperation.non.get()); | ||
userEvent.click(ui.next.get()); | ||
fireEvent.change(ui.seniority.startDate.get(), { | ||
target: { value: "01/01/2000" }, | ||
}); | ||
fireEvent.change(ui.seniority.notificationDate.get(), { | ||
target: { value: "01/01/2022" }, | ||
}); | ||
fireEvent.change(ui.seniority.endDate.get(), { | ||
target: { value: "01/03/2022" }, | ||
}); | ||
fireEvent.click(ui.seniority.hasAbsence.non.get()); | ||
fireEvent.click(ui.next.get()); | ||
fireEvent.click(ui.salary.hasPartialTime.non.get()); | ||
fireEvent.click(ui.salary.hasSameSalary.oui.get()); | ||
fireEvent.change(ui.salary.sameSalaryValue.get(), { | ||
target: { value: "3000" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
expect(ui.activeStep.query()).toHaveTextContent("Indemnité"); | ||
}); | ||
describe("Etant donné un CDI opération", () => { | ||
beforeEach(() => | ||
userEvent.click(ui.information.agreement1404.cdiOperation.oui.get()) | ||
); | ||
describe("Etant donné une ancienneté < 6 mois", () => { | ||
beforeEach(() => | ||
fireEvent.change(ui.information.agreement1404.duree.get(), { | ||
target: { value: "5" }, | ||
}) | ||
); | ||
test("Vérifier que le licenciement avant fin de la période d'essai amène au résultat", () => { | ||
userEvent.click(ui.information.agreement1404.trial.oui.get()); | ||
userEvent.click(ui.next.get()); | ||
fireEvent.change(ui.seniority.startDate.get(), { | ||
target: { value: "01/01/2022" }, | ||
}); | ||
fireEvent.change(ui.seniority.notificationDate.get(), { | ||
target: { value: "01/04/2022" }, | ||
}); | ||
fireEvent.change(ui.seniority.endDate.get(), { | ||
target: { value: "01/05/2022" }, | ||
}); | ||
fireEvent.click(ui.seniority.hasAbsence.non.get()); | ||
fireEvent.click(ui.next.get()); | ||
expect(ui.activeStep.query()).toHaveTextContent("Indemnité"); | ||
}); | ||
test("Vérifier que le licenciement après fin de la période d'essai amène au résultat", () => { | ||
userEvent.click(ui.information.agreement1404.trial.non.get()); | ||
fireEvent.change(ui.information.agreement1404.salaryTotal.get(), { | ||
target: { value: "50000" }, | ||
}); | ||
userEvent.click(ui.next.get()); | ||
fireEvent.change(ui.seniority.startDate.get(), { | ||
target: { value: "01/01/2022" }, | ||
}); | ||
fireEvent.change(ui.seniority.notificationDate.get(), { | ||
target: { value: "01/04/2022" }, | ||
}); | ||
fireEvent.change(ui.seniority.endDate.get(), { | ||
target: { value: "01/05/2022" }, | ||
}); | ||
fireEvent.click(ui.seniority.hasAbsence.non.get()); | ||
fireEvent.click(ui.next.get()); | ||
expect(ui.activeStep.query()).toHaveTextContent("Indemnité"); | ||
}); | ||
}); | ||
test("Vérifier qu'avec plus de 6 mois on arrive au résultat", () => { | ||
fireEvent.change(ui.information.agreement1404.duree.get(), { | ||
target: { value: "30" }, | ||
}); | ||
fireEvent.change(ui.information.agreement1404.salary1.get(), { | ||
target: { value: "100000" }, | ||
}); | ||
fireEvent.change(ui.information.agreement1404.salary2.get(), { | ||
target: { value: "150000" }, | ||
}); | ||
fireEvent.change(ui.information.agreement1404.salary3.get(), { | ||
target: { value: "200000" }, | ||
}); | ||
userEvent.click(ui.next.get()); | ||
fireEvent.change(ui.seniority.startDate.get(), { | ||
target: { value: "01/01/2000" }, | ||
}); | ||
fireEvent.change(ui.seniority.notificationDate.get(), { | ||
target: { value: "01/01/2022" }, | ||
}); | ||
fireEvent.change(ui.seniority.endDate.get(), { | ||
target: { value: "01/03/2022" }, | ||
}); | ||
fireEvent.click(ui.seniority.hasAbsence.non.get()); | ||
fireEvent.click(ui.next.get()); | ||
expect(ui.activeStep.query()).toHaveTextContent("Indemnité"); | ||
}); | ||
}); | ||
}); |
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
3 changes: 3 additions & 0 deletions
3
...-travail-frontend/src/outils/IndemniteLicenciement/common/usecase/hasNoBetterAllowance.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,3 @@ | ||
const hasNoBetterAllowance = (ccn: number): boolean => ccn === 3239; | ||
|
||
export default hasNoBetterAllowance; |
12 changes: 11 additions & 1 deletion
12
...u-travail-frontend/src/outils/IndemniteLicenciement/common/usecase/hasNoLegalIndemnity.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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
const hasNoLegalIndemnity = (ccn: number): boolean => ccn === 3239; | ||
import { AgreementInformation } from "../types"; | ||
|
||
const hasNoLegalIndemnity = ( | ||
ccn: number, | ||
agreementInformations?: AgreementInformation[] | ||
): boolean => | ||
ccn === 3239 || | ||
(ccn === 1404 && | ||
!!agreementInformations?.some( | ||
({ label, value }) => label === "CDI d'opération" && value === "'Oui'" | ||
)); | ||
|
||
export default hasNoLegalIndemnity; |
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
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
Oops, something went wrong.