-
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: 6189 ajout des tests UI pour le simu preavis de licenciement (#…
…6191) * feat: add TU preavis licenciement * chore: update TU * chore: json updates * chore: update TU * chore: format * feat: revert calendaire * test: ajout d'un test sur la 3239 * fix: retrait du résultat avec virgule sur la 843 --------- Co-authored-by: Victor <[email protected]> Co-authored-by: Martial Maillot <[email protected]>
- Loading branch information
1 parent
6db4f07
commit 7f6a995
Showing
51 changed files
with
10,455 additions
and
21 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
...u-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1043.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,97 @@ | ||
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": 1043, | ||
"shortTitle": "shortTitle", | ||
"id": "id", | ||
"title": "title", | ||
"url": "https://www.url.fr", | ||
"slug": "1043" | ||
} | ||
` | ||
); | ||
|
||
describe("DureePreavisLicenciement", () => { | ||
beforeEach(() => { | ||
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()); | ||
}); | ||
|
||
describe("criteria.catégorie professionnelle = 79| A", () => { | ||
beforeEach(() => { | ||
fireEvent.change( | ||
screen.getByTestId("criteria.catégorie professionnelle"), | ||
{ | ||
target: { value: "79| A" }, | ||
} | ||
); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
describe("criteria.ancienneté = 38| Moins de 2 ans", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "38| Moins de 2 ans" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/Article 14/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("criteria.ancienneté = 43| Plus de 2 ans", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "43| Plus de 2 ans" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/Article 14/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("criteria.catégorie professionnelle = 80| B", () => { | ||
beforeEach(() => { | ||
fireEvent.change( | ||
screen.getByTestId("criteria.catégorie professionnelle"), | ||
{ | ||
target: { value: "80| B" }, | ||
} | ||
); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/Article 14/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
202 changes: 202 additions & 0 deletions
202
...u-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1090.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,202 @@ | ||
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": 1090, | ||
"shortTitle": "shortTitle", | ||
"id": "id", | ||
"title": "title", | ||
"url": "https://www.url.fr", | ||
"slug": "1090" | ||
} | ||
` | ||
); | ||
|
||
describe("DureePreavisLicenciement", () => { | ||
beforeEach(() => { | ||
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()); | ||
}); | ||
|
||
describe("criteria.catégorie professionnelle = 23| Agents de maîtrise", () => { | ||
beforeEach(() => { | ||
fireEvent.change( | ||
screen.getByTestId("criteria.catégorie professionnelle"), | ||
{ | ||
target: { value: "23| Agents de maîtrise" }, | ||
} | ||
); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
describe("criteria.échelon = 4| De 17 à 19", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.échelon"), { | ||
target: { value: "4| De 17 à 19" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/Article 4.10/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("criteria.échelon = 5| De 20 à 25", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.échelon"), { | ||
target: { value: "5| De 20 à 25" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/Article 4.10/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("criteria.catégorie professionnelle = 48| Cadres", () => { | ||
beforeEach(() => { | ||
fireEvent.change( | ||
screen.getByTestId("criteria.catégorie professionnelle"), | ||
{ | ||
target: { value: "48| Cadres" }, | ||
} | ||
); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/Article 4.10/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("criteria.catégorie professionnelle = 6| Ouvriers, Employés", () => { | ||
beforeEach(() => { | ||
fireEvent.change( | ||
screen.getByTestId("criteria.catégorie professionnelle"), | ||
{ | ||
target: { value: "6| Ouvriers, Employés" }, | ||
} | ||
); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
describe("criteria.échelon = 2| 1 et 2", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.échelon"), { | ||
target: { value: "2| 1 et 2" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
describe("criteria.ancienneté = 15| Moins de 6 mois", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "15| Moins de 6 mois" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/article 2.12/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("criteria.ancienneté = 35| 6 mois à 2 ans", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "35| 6 mois à 2 ans" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/article 2.12/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("criteria.ancienneté = 42| 2 ans ou plus", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "42| 2 ans ou plus" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/article 2.12/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("criteria.échelon = 3| De 3 à 12", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.échelon"), { | ||
target: { value: "3| De 3 à 12" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
describe("criteria.ancienneté = 38| Moins de 2 ans", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "38| Moins de 2 ans" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/article 2.12/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe("criteria.ancienneté = 42| 2 ans ou plus", () => { | ||
beforeEach(() => { | ||
fireEvent.change(screen.getByTestId("criteria.ancienneté"), { | ||
target: { value: "42| 2 ans ou plus" }, | ||
}); | ||
fireEvent.click(ui.next.get()); | ||
}); | ||
|
||
it("should display expected answer", () => { | ||
expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); | ||
|
||
expect(screen.queryAllByText(/article 2.12/)[0]).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.