-
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.
fix: formulation lorsque le résultat légal et cc est identique (#6250)
- Loading branch information
Showing
3 changed files
with
123 additions
and
9 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
...avail-frontend/src/outils/DureePreavisLicenciement/__tests__/wording-same-result.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,87 @@ | ||
import { DureePreavisLicenciement } from "../index"; | ||
import { ui } from "./ui"; | ||
import { fireEvent, render, screen } from "@testing-library/react"; | ||
|
||
jest.spyOn(Storage.prototype, "setItem"); | ||
Storage.prototype.getItem = jest.fn( | ||
() => ` | ||
{ | ||
"num": 3239, | ||
"shortTitle": "shortTitle", | ||
"id": "id", | ||
"title": "title", | ||
"url": "https://www.url.fr", | ||
"slug": "3239" | ||
} | ||
` | ||
); | ||
|
||
describe("DureePreavisLicenciement : wording on same result", () => { | ||
test("Should display a specific message when legal and agreement result are equals", () => { | ||
render(<DureePreavisLicenciement icon={""} title={""} displayTitle={""} />); | ||
fireEvent.click(ui.introduction.startButton.get()); | ||
|
||
fireEvent.click(screen.getByTestId("seriousMisconduct-non")); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.click(screen.getByTestId("disabledWorker-non")); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.change(screen.getByTestId("cdt.ancienneté"), { | ||
target: { value: "43| Plus de 2 ans" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.change(screen.getByTestId("criteria.catégorie professionnelle"), { | ||
target: { value: "100| Salariés du particulier employeur" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "42| 2 ans ou plus" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
|
||
expect( | ||
screen.queryByText( | ||
/La durée prévue par le code du travail est le même que celle prévue par la convention collective/ | ||
) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
test("Should display default message when legal and agreement result are not equals", () => { | ||
render(<DureePreavisLicenciement icon={""} title={""} displayTitle={""} />); | ||
fireEvent.click(ui.introduction.startButton.get()); | ||
|
||
fireEvent.click(screen.getByTestId("seriousMisconduct-non")); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.click(screen.getByTestId("disabledWorker-non")); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.change(screen.getByTestId("cdt.ancienneté"), { | ||
target: { value: "15| Moins de 6 mois" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.change(screen.getByTestId("criteria.catégorie professionnelle"), { | ||
target: { value: "100| Salariés du particulier employeur" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
|
||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "42| 2 ans ou plus" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
|
||
expect( | ||
screen.queryByText( | ||
/Il s’agit de la durée la plus longue entre la durée légale prévue par le Code du travail et la durée conventionnelle prévue par la convention collective/ | ||
) | ||
).toBeInTheDocument(); | ||
}); | ||
}); |
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