diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1043.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1043.test.tsx new file mode 100644 index 0000000000..7fd9b941a8 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1043.test.tsx @@ -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(); + 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(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1090.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1090.test.tsx new file mode 100644 index 0000000000..dfc43fed57 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1090.test.tsx @@ -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(); + 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(); + }); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1147.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1147.test.tsx new file mode 100644 index 0000000000..30a49cecb6 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1147.test.tsx @@ -0,0 +1,120 @@ +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": 1147, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1147" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 25 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 38| Non-cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "38| Non-cadres" }, + } + ); + 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(/15 jours/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/article 25 de la convention collective/)[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 25 de la convention collective/)[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 25 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1266.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1266.test.tsx new file mode 100644 index 0000000000..53065a77ff --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1266.test.tsx @@ -0,0 +1,158 @@ +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": 1266, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1266" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 \(sauf stipulation contractuelle différente\)/g + )[0] + ).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 13/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + 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(/8 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 13/)[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 13/)[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 13/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 26| Maîtrises", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "26| Maîtrises" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 13/)[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 13/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1351.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1351.test.tsx new file mode 100644 index 0000000000..e9c65ce0b8 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1351.test.tsx @@ -0,0 +1,1392 @@ +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": 1351, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1351" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 20| Agents d'exploitation, employés administratifs et techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: + "20| Agents d'exploitation, employés administratifs et techniciens", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 2| 15 jours à 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "2| 15 jours à 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 jour ouvré/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 8| Plus de 1 mois à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "8| Plus de 1 mois à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/2 jours ouvrés/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 18| Plus de 2 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "18| Plus de 2 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/7 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 2| 15 jours à 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "2| 15 jours à 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 jour ouvré/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 8| Plus de 1 mois à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "8| Plus de 1 mois à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/2 jours ouvrés/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 18| Plus de 2 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "18| Plus de 2 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/7 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 2| 15 jours à 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "2| 15 jours à 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 jour ouvré/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 8| Plus de 1 mois à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "8| Plus de 1 mois à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/2 jours ouvrés/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 18| Plus de 2 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "18| Plus de 2 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/7 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 2| 15 jours à 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "2| 15 jours à 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 jour ouvré/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 8| Plus de 1 mois à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "8| Plus de 1 mois à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/2 jours ouvrés/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 18| Plus de 2 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "18| Plus de 2 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/14 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 2| 15 jours à 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "2| 15 jours à 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 jour ouvré/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 8| Plus de 1 mois à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "8| Plus de 1 mois à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/2 jours ouvrés/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 18| Plus de 2 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "18| Plus de 2 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/14 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[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( + /Annexe IV: Agents d'exploitation, employés administratifs et techniciens, article 9/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + }); + + 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.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 7| 15 jours à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "7| 15 jours à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 12| Plus de 2 mois à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "12| Plus de 2 mois à 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 20| Plus de 3 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "20| Plus de 3 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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(/Annexe V: Agents de maîtrise, article 8/)[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(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 7| 15 jours à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "7| 15 jours à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 12| Plus de 2 mois à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "12| Plus de 2 mois à 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 20| Plus de 3 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "20| Plus de 3 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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(/Annexe V: Agents de maîtrise, article 8/)[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(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 7| 15 jours à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "7| 15 jours à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 12| Plus de 2 mois à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "12| Plus de 2 mois à 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 20| Plus de 3 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "20| Plus de 3 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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(/Annexe V: Agents de maîtrise, article 8/)[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(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 7| 15 jours à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "7| 15 jours à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 12| Plus de 2 mois à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "12| Plus de 2 mois à 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 20| Plus de 3 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "20| Plus de 3 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 6 mois à 2 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 7| 15 jours à 2 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "7| 15 jours à 2 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 12| Plus de 2 mois à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "12| Plus de 2 mois à 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 20| Plus de 3 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "20| Plus de 3 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 6 mois à 2 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe V: Agents de maîtrise, article 8/)[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()); + }); + + describe("criteria.ancienneté = 1| Moins de 15 jours", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "1| Moins de 15 jours" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe VI: Cadres, article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 2| 15 jours à 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "2| 15 jours à 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/7 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe VI: Cadres, article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 11| Plus de 1 mois à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "11| Plus de 1 mois à 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/14 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe VI: Cadres, article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 20| Plus de 3 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "20| Plus de 3 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe VI: Cadres, article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 26| Plus de 6 mois à 1 an", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "26| Plus de 6 mois à 1 an" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe VI: Cadres, article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 27| Plus de 1 an", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "27| Plus de 1 an" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe VI: Cadres, article 9/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1404.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1404.test.tsx new file mode 100644 index 0000000000..e0f0198e7e --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1404.test.tsx @@ -0,0 +1,234 @@ +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": 1404, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1404" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 48| Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "48| Cadres" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.niveau = 10| VII et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "10| VII et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 6-50/)[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.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + 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 3-41-0/)[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 3-41-0/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + 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 3-41-0/)[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 3-41-0/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 3-41-0/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 27| Techniciens et agents de maîtrise (TAM)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "27| Techniciens et agents de maîtrise (TAM)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 3-41-0/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 3-41-0/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.niveau = 8| VI", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "8| VI" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 3-41-0/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1480.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1480.test.tsx new file mode 100644 index 0000000000..801a097bc4 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1480.test.tsx @@ -0,0 +1,67 @@ +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": 1480, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1480" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.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 46/)[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 46/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1483.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1483.test.tsx new file mode 100644 index 0000000000..cc931c9ace --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1483.test.tsx @@ -0,0 +1,140 @@ +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": 1483, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1483" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 9, chapitre II/)[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 9, chapitre II/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 21| 6 mois ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "21| 6 mois ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 15, chapitre I/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 36| Plus de 6 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "36| Plus de 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 15, chapitre I/)[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 15, chapitre I/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1486.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1486.test.tsx new file mode 100644 index 0000000000..7bfda557f9 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1486.test.tsx @@ -0,0 +1,173 @@ +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": 1486, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1486" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 78| Chargés d'enquête intermittents", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "78| Chargés d'enquête intermittents" }, + } + ); + 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( + /Annexe relative aux enquêteurs - Accord du 16 décembre 1991, article 21/ + )[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( + /Annexe relative aux enquêteurs - Accord du 16 décembre 1991, article 21/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 19| Employés, Techniciens ou Agents de maîtrise (ETAM)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: "19| Employés, Techniciens ou Agents de maîtrise (ETAM)", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 16| de 240 à 355", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "16| de 240 à 355" }, + }); + 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 4.2/)[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 4.2/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 19| De 400 à 500", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "19| De 400 à 500" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.2/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 60| Ingénieurs, Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "60| Ingénieurs, Cadres" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.2/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1501.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1501.test.tsx new file mode 100644 index 0000000000..01fb6f73ed --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1501.test.tsx @@ -0,0 +1,154 @@ +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": 1501, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1501" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 12/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 26| Maîtrises", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "26| Maîtrises" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 12/)[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 12/)[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.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(/8 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 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 12/)[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 12/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1505.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1505.test.tsx new file mode 100644 index 0000000000..f5ada0ace5 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1505.test.tsx @@ -0,0 +1,115 @@ +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": 1505, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1505" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 (AM1 et AM2)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "23| Agents de maîtrise (AM1 et AM2)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 20/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 48| Cadres (C1 et C2)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "48| Cadres (C1 et C2)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 20/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 6| Employés (E1 à E7)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "6| Employés (E1 à E7)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 20/)[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 20/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1516.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1516.test.tsx new file mode 100644 index 0000000000..1bf7a02733 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1516.test.tsx @@ -0,0 +1,115 @@ +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": 1516, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1516" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 9.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 9.1/)[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 9.1/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 28| Agents de maîtrise ou techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "28| Agents de maîtrise ou techniciens" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 9.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1517.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1517.test.tsx new file mode 100644 index 0000000000..7741b4a21d --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1517.test.tsx @@ -0,0 +1,424 @@ +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": 1517, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1517" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + 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(/Chapitre VI, Article 1/)[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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + 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(/Chapitre VI, Article 1/)[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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + 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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + + 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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + 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(/Chapitre VI, Article 1/)[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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + 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(/Chapitre VI, Article 1/)[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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 8| VI", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "8| VI" }, + }); + 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(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[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(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 9| VII", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "9| VII" }, + }); + 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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 11| VIII", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "11| VIII" }, + }); + 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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 12| IX", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "12| IX" }, + }); + 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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Chapitre VI, Article 1/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1518.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1518.test.tsx new file mode 100644 index 0000000000..2c88bc860a --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1518.test.tsx @@ -0,0 +1,268 @@ +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": 1518, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1518" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 21| Agents de maîtrise et Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "21| Agents de maîtrise et Techniciens" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 15| 4", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "15| 4" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 16| 5", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "16| 5" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 17| 6", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "17| 6" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 45| Animateurs, techniciens et professeurs", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "45| Animateurs, techniciens et professeurs" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.niveau = 13| A", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "13| A" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.niveau = 14| B", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "14| B" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[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()); + }); + + describe("criteria.groupe = 18| 7", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "18| 7" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 19| 8", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "19| 8" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[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.groupe = 13| 2", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "13| 2" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[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 4.4/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 14| 3", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "14| 3" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[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 4.4/)[0]).toBeInTheDocument(); + }); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1527.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1527.test.tsx new file mode 100644 index 0000000000..4c85ae0494 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1527.test.tsx @@ -0,0 +1,223 @@ +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": 1527, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1527" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 24| Moins de 1 an", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "24| Moins de 1 an" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 32/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 25| Au moins 1 an", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "25| Au moins 1 an" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 32/)[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 32/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 76| Négociateur non VRP", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "76| Négociateur non VRP" }, + } + ); + 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 32/)[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 32/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 77| Négociateur VRP", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "77| Négociateur VRP" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 24| Moins de 1 an", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "24| Moins de 1 an" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 32/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 32/)[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.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 32/)[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 32/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1596.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1596.test.tsx new file mode 100644 index 0000000000..744c2f7da6 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1596.test.tsx @@ -0,0 +1,99 @@ +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": 1596, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1596" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 10| Au delà de la période d'essai et jusqu'à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { + value: "10| Au delà de la période d'essai et jusqu'à 3 mois", + }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 10.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 19| De 3 à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "19| De 3 à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 10.1/)[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 10.1/)[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 10.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1597.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1597.test.tsx new file mode 100644 index 0000000000..c74eef81db --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1597.test.tsx @@ -0,0 +1,99 @@ +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": 1597, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1597" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 10| Au delà de la période d'essai et jusqu'à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { + value: "10| Au delà de la période d'essai et jusqu'à 3 mois", + }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 10.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 19| De 3 à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "19| De 3 à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 10.1/)[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 10.1/)[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 10.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/16.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/16.test.tsx new file mode 100644 index 0000000000..ba22d74f39 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/16.test.tsx @@ -0,0 +1,274 @@ +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": 16, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "16" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe II, article 13/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 30| 1 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "30| 1 mois à 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(/Annexe II, article 13/)[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(/Annexe II, article 13/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 61| Ingénieurs et Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "61| Ingénieurs et Cadres" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe IV, Article 15/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 4| Ouvriers", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "4| Ouvriers" }, + } + ); + 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(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe I, chapitre Ier, article 5/)[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(/Annexe I, chapitre Ier, article 5/)[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(/Annexe I, chapitre Ier, article 5/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 27| Techniciens et agents de maîtrise (TAM)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "27| Techniciens et agents de maîtrise (TAM)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 25| 1 à 5 ", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "25| 1 à 5 " }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/Aucun préavis/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe III, article 17/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 30| 1 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "30| 1 mois à 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(/Annexe III, article 17/)[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(/Annexe III, article 17/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 30| 6 à 8", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "30| 6 à 8" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe III, article 17/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1606.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1606.test.tsx new file mode 100644 index 0000000000..2b69b3736d --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1606.test.tsx @@ -0,0 +1,201 @@ +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": 1606, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1606" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 17| Entre 2 et 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "17| Entre 2 et 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/annexe "agents de maîtrise" article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 22| Plus de 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "22| Plus de 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/annexe "agents de maîtrise" article 9/)[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()); + }); + + describe("criteria.ancienneté = 19| De 3 à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "19| De 3 à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/annexe "cadres" article 9/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 22| Plus de 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "22| Plus de 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/annexe "cadres" article 9/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 9.2.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 14| 1 mois à moins de 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "14| 1 mois à moins de 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/15 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 9.2.1/)[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 9.2.1/)[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 9.2.1/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1672.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1672.test.tsx new file mode 100644 index 0000000000..2c7f3ef704 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1672.test.tsx @@ -0,0 +1,274 @@ +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": 1672, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1672" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 48| Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "48| Cadres" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.classe = 5| 5", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "5| 5" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Accord relative aux dispositions particulières " Cadres ", article II. 6/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.classe = 6| 6", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "6| 6" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Accord relative aux dispositions particulières " Cadres ", article II. 6/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.classe = 7| 7", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "7| 7" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Accord relative aux dispositions particulières " Cadres ", article II. 6/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 38| Non-cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "38| Non-cadres" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.classe = 1| 1", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "1| 1" }, + }); + 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 91a/)[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 91a/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.classe = 2| 2", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "2| 2" }, + }); + 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 91a/)[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 91a/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.classe = 3| 3", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "3| 3" }, + }); + 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 91a/)[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 91a/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.classe = 4| 4", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.classe"), { + target: { value: "4| 4" }, + }); + 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 91a/)[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 91a/)[0]).toBeInTheDocument(); + }); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1702.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1702.test.tsx new file mode 100644 index 0000000000..f21f625caf --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1702.test.tsx @@ -0,0 +1,99 @@ +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": 1702, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1702" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 10| Au delà de la période d'essai et jusqu'à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { + value: "10| Au delà de la période d'essai et jusqu'à 3 mois", + }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 10.1.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 19| De 3 à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "19| De 3 à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 10.1.1/)[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 10.1.1/)[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 10.1.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1740.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1740.test.tsx new file mode 100644 index 0000000000..d866531bf9 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1740.test.tsx @@ -0,0 +1,99 @@ +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": 1740, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1740" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 10| Au delà de la période d'essai et jusqu'à 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { + value: "10| Au delà de la période d'essai et jusqu'à 3 mois", + }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 1.1.9/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 19| De 3 à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "19| De 3 à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 1.1.9/)[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 1.1.9/)[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 1.1.9/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/176.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/176.test.tsx new file mode 100644 index 0000000000..f3a3c02a0b --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/176.test.tsx @@ -0,0 +1,155 @@ +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": 176, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "176" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.conclusion contrat travail = 1| Contrat de travail conclu avant le 1er juillet 2009", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.conclusion contrat travail"), + { + target: { + value: "1| Contrat de travail conclu avant le 1er juillet 2009", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 24| 1 à 3", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "24| 1 à 3" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35, 2°/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 15| 4", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "15| 4" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35, 2°/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 29| 5 et suivants", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "29| 5 et suivants" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35, 2°/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.conclusion contrat travail = 2| Contrat de travail conclu après le 1er juillet 2009", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.conclusion contrat travail"), + { + target: { + value: "2| Contrat de travail conclu après le 1er juillet 2009", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 24| 1 à 3", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "24| 1 à 3" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35, 2°/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 28| 4 à 6 ", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "28| 4 à 6 " }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35, 2°/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 31| 6 et suivants ", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "31| 6 et suivants " }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/4 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35, 2°/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1960.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1960.test.tsx new file mode 100644 index 0000000000..e8647a9440 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1960.test.tsx @@ -0,0 +1,235 @@ +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": 1960, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1960" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + 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 20 des clauses particulières concernant les mensuels/ + )[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 20 des clauses particulières concernant les mensuels/ + )[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 20 des clauses particulières concernant les mensuels/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 20 des clauses particulières concernant les mensuels/ + )[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 20 des clauses particulières concernant les mensuels/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 20 des clauses particulières concernant les mensuels/ + )[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 20 des clauses particulières concernant les mensuels/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 20 des clauses particulières concernant les mensuels/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 20 des clauses particulières concernant les mensuels/ + )[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1979.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1979.test.tsx new file mode 100644 index 0000000000..2a25b9ad61 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1979.test.tsx @@ -0,0 +1,208 @@ +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": 1979, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1979" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 48| Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "48| Cadres" }, + } + ); + 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(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 30.2/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 33| 6 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "33| 6 mois à moins de 2 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 30.2/)[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 30.2/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + 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(/8 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 30.2/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 33| 6 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "33| 6 mois à 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 30.2/)[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 30.2/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 26| Maîtrises", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "26| Maîtrises" }, + } + ); + 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(/15 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 30.2/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 33| 6 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "33| 6 mois à 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 30.2/)[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 30.2/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1996.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1996.test.tsx new file mode 100644 index 0000000000..67c1338c58 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/1996.test.tsx @@ -0,0 +1,105 @@ +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": 1996, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "1996" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 6 des dispositions particulières aux cadres/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 38| Non-cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "38| Non-cadres" }, + } + ); + 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 20 de la convention collective/)[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 20 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2098.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2098.test.tsx new file mode 100644 index 0000000000..e0e1ac8665 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2098.test.tsx @@ -0,0 +1,115 @@ +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": 2098, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2098" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 19.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 19.1/)[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 19.1/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 27| Techniciens et agents de maîtrise (TAM)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "27| Techniciens et agents de maîtrise (TAM)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 19.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2120.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2120.test.tsx new file mode 100644 index 0000000000..1baf53bfe9 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2120.test.tsx @@ -0,0 +1,103 @@ +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": 2120, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2120" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 30 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 28| Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "28| Techniciens" }, + } + ); + 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 30 de la convention collective/)[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 30 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2148.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2148.test.tsx new file mode 100644 index 0000000000..b090ea052c --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2148.test.tsx @@ -0,0 +1,125 @@ +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": 2148, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2148" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.groupe = 20| A et B", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "20| A et B" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4.1.1/)[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 4.4.1.1/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 21| C et D", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "21| C et D" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4.1.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 22| E, F et G", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "22| E, F et G" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4.1.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 23| Hors classification", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "23| Hors classification" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText( + /pour les salariés hors classification, la durée du préavis est fixée par le contrat de travail dans la limite de 3 mois/g + )[0] + ).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4.1.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2216.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2216.test.tsx new file mode 100644 index 0000000000..e218bc3279 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2216.test.tsx @@ -0,0 +1,160 @@ +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": 2216, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2216" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/article 5 de l'annexe II/)[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 7 de l'annexe III/)[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.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/article 3 de l'annexe I/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 31| 1 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "31| 1 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 3 de l'annexe I/)[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 3 de l'annexe I/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 28| Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "28| Techniciens" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/article 5 de l'annexe II/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2264.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2264.test.tsx new file mode 100644 index 0000000000..7923d713a3 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2264.test.tsx @@ -0,0 +1,175 @@ +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": 2264, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2264" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 45/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 68| Cadres dirigeants", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "68| Cadres dirigeants" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 45/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 63| Cadres supérieurs", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "63| Cadres supérieurs" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 45/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + 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 45/)[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 45/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 27| Techniciens et agents de maîtrise (TAM)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "27| Techniciens et agents de maîtrise (TAM)" }, + } + ); + 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 45/)[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 45/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2511.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2511.test.tsx new file mode 100644 index 0000000000..57cf441b4f --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2511.test.tsx @@ -0,0 +1,107 @@ +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": 2511, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2511" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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.4.3.2 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 38| Non-cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "38| Non-cadres" }, + } + ); + 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 4.4.3.2 de la convention collective/ + )[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 4.4.3.2 de la convention collective/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2596.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2596.test.tsx new file mode 100644 index 0000000000..d7f201092b --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2596.test.tsx @@ -0,0 +1,251 @@ +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": 2596, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2596" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 7.4.1/)[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 7.4.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 33| Salariés occupant un emploi de l'esthétique-cosmétique", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: "33| Salariés occupant un emploi de l'esthétique-cosmétique", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 21| 6 mois ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "21| 6 mois ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 7.4.1/)[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 7.4.1/)[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 7.4.1/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 32| Salariés occupant un emploi non-technique de la coiffure", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: + "32| Salariés occupant un emploi non-technique de la coiffure", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 21| 6 mois ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "21| 6 mois ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 7.4.1/)[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 7.4.1/)[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 7.4.1/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 31| Salariés occupant un emploi technique de la coiffure", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: "31| Salariés occupant un emploi technique de la coiffure", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 21| 6 mois ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "21| 6 mois ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 7.4.1/)[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 7.4.1/)[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 7.4.1/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2609.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2609.test.tsx new file mode 100644 index 0000000000..d1ce109b55 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2609.test.tsx @@ -0,0 +1,115 @@ +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": 2609, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2609" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.âge = 3| Moins de 55 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "3| Moins de 55 ans" }, + }); + 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 8.1/)[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 8.1/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.âge = 5| Plus de 55 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "5| Plus de 55 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 50| Au moins 15 ans d'ancienneté", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "50| Au moins 15 ans d'ancienneté" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 8.1/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 49| Moins de 15 ans d'ancienneté", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "49| Moins de 15 ans d'ancienneté" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 8.1/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2614.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2614.test.tsx new file mode 100644 index 0000000000..3b6e655f58 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2614.test.tsx @@ -0,0 +1,123 @@ +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": 2614, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2614" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.âge = 3| Moins de 55 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "3| Moins de 55 ans" }, + }); + 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 8.1 de la convention collective/)[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 8.1 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.âge = 4| 55 ans et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "4| 55 ans et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 50| Au moins 15 ans d'ancienneté", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "50| Au moins 15 ans d'ancienneté" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 8.1 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 49| Moins de 15 ans d'ancienneté", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "49| Moins de 15 ans d'ancienneté" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 8.1 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/275.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/275.test.tsx new file mode 100644 index 0000000000..9fef09eead --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/275.test.tsx @@ -0,0 +1,241 @@ +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": 275, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "275" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.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 11, Annexe II/)[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 11, Annexe II/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 28| Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "28| Techniciens" }, + } + ); + 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 11, Annexe II/)[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 11, Annexe II/)[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 10, Annexe I/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 4| Ouvriers", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "4| Ouvriers" }, + } + ); + 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 15, Annexe III/)[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 15, Annexe III/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + 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 15, Annexe III/)[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 15, Annexe III/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/292.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/292.test.tsx new file mode 100644 index 0000000000..74a2710739 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/292.test.tsx @@ -0,0 +1,129 @@ +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": 292, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "292" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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(/Avenant Cadres, Article 8/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 42| Collaborateurs", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "42| Collaborateurs" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 24| 700 à 750", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "24| 700 à 750" }, + }); + 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(/Avenant Collaborateurs, Article 15/)[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(/Avenant Collaborateurs, Article 15/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 28| 800 à 830 inclus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "28| 800 à 830 inclus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant Collaborateurs, Article 15/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2941.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2941.test.tsx new file mode 100644 index 0000000000..1e49daeea0 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/2941.test.tsx @@ -0,0 +1,206 @@ +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": 2941, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "2941" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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| Employé", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "79| Employé" }, + } + ); + 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(/1 semaine \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[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 \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[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 \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 84| Technicien-agent de maîtrise", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "84| Technicien-agent de maîtrise" }, + } + ); + 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 \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[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 \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 86| Cadre", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "86| Cadre" }, + } + ); + 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(/2 mois \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[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(/4 mois \(de date à date\)/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Titre IV, Article 26.1/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3043.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3043.test.tsx new file mode 100644 index 0000000000..679c18cee5 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3043.test.tsx @@ -0,0 +1,226 @@ +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": 3043, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "3043" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 1| Agents de propreté", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "1| Agents de propreté" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.11.2/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 14| 1 mois à moins de 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "14| 1 mois à moins de 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 semaine/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.11.2/)[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 4.11.2/)[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 4.11.2/)[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.11.2/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.11.2/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 31| 1 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "31| 1 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 4.11.2/)[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 4.11.2/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 27| Techniciens et agents de maîtrise (TAM)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "27| Techniciens et agents de maîtrise (TAM)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 32| 2 mois à 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "32| 2 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 4.11.2/)[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 4.11.2/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3127.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3127.test.tsx new file mode 100644 index 0000000000..554390357a --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3127.test.tsx @@ -0,0 +1,75 @@ +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": 3127, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "3127" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.ancienneté = 33| 6 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "33| 6 mois à 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 1. 1 de la section 1 du Chapitre 4 de la Partie II de la convention collective/ + )[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 1. 1 de la section 1 du Chapitre 4 de la Partie II de la convention collective/ + )[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3239.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3239.test.tsx new file mode 100644 index 0000000000..e5647ff0a6 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3239.test.tsx @@ -0,0 +1,211 @@ +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", () => { + beforeEach(() => { + render(); + 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 = 100| Salariés du particulier employeur", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "100| Salariés du particulier employeur" }, + } + ); + 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(/1 semaine/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 162.4.1/)[0]).toBeInTheDocument(); + + expect( + screen.queryByText( + /Le contrat de travail ou un usage peut prévoir une durée de préavis ou une condition d’ancienneté plus favorable pour le salarié. Dans ce cas, c’est cette durée ou cette ancienneté plus favorable qui s’applique au salarié/ + ) + ).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 162.4.1/)[0]).toBeInTheDocument(); + + expect( + screen.queryByText( + /Le contrat de travail ou un usage peut prévoir une durée de préavis ou une condition d’ancienneté plus favorable pour le salarié. Dans ce cas, c’est cette durée ou cette ancienneté plus favorable qui s’applique au salarié/ + ) + ).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 162.4.1/)[0]).toBeInTheDocument(); + + expect( + screen.queryByText( + /Le contrat de travail ou un usage peut prévoir une durée de préavis ou une condition d’ancienneté plus favorable pour le salarié. Dans ce cas, c’est cette durée ou cette ancienneté plus favorable qui s’applique au salarié/ + ) + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 101| Assistants maternels du particulier employeur", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: "101| Assistants maternels du particulier employeur", + }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 105| Enfant accueilli depuis moins de 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "105| Enfant accueilli depuis moins de 3 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/8 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Art. L. 423-25 du Code de l'action sociale et des familles/ + )[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Art. 120 de la convention collective/)[0] + ).toBeInTheDocument(); + expect( + screen.queryByText( + /Le contrat de travail ou un usage peut prévoir une durée de préavis ou une condition d’ancienneté plus favorable pour le salarié. Dans ce cas, c’est cette durée ou cette ancienneté plus favorable qui s’applique au salarié/ + ) + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 106| Enfant accueilli de 3 mois à moins d'un an", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "106| Enfant accueilli de 3 mois à moins d'un an" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect( + screen.queryAllByText(/15 jours calendaires/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Art. L. 423-25 du Code de l'action sociale et des familles/ + )[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Art. 120 de la convention collective/)[0] + ).toBeInTheDocument(); + expect( + screen.queryByText( + /Le contrat de travail ou un usage peut prévoir une durée de préavis ou une condition d’ancienneté plus favorable pour le salarié. Dans ce cas, c’est cette durée ou cette ancienneté plus favorable qui s’applique au salarié/ + ) + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 107| Enfant accueilli depuis 1 an et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "107| Enfant accueilli depuis 1 an et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Art. L. 423-25 du Code de l'action sociale et des familles/ + )[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Art. 120 de la convention collective/)[0] + ).toBeInTheDocument(); + expect( + screen.queryByText( + /Le contrat de travail ou un usage peut prévoir une durée de préavis ou une condition d’ancienneté plus favorable pour le salarié. Dans ce cas, c’est cette durée ou cette ancienneté plus favorable qui s’applique au salarié/ + ) + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3248.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3248.test.tsx new file mode 100644 index 0000000000..36831e625f --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/3248.test.tsx @@ -0,0 +1,517 @@ +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": 3248, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "3248" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.âge = 1| Moins de 50 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "1| Moins de 50 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.position = 1| A, B, C ou D", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "1| A, B, C ou D" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.anciennement cadre = 2| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.anciennement cadre"), { + target: { value: "2| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.position = 2| E", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "2| E" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.anciennement cadre = 2| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.anciennement cadre"), { + target: { value: "2| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.position = 3| F, G, H ou I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "3| F, G, H ou I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.âge = 2| 50 ans à 55 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "2| 50 ans à 55 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.position = 1| A, B, C ou D", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "1| A, B, C ou D" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.anciennement cadre = 2| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.anciennement cadre"), { + target: { value: "2| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/4 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.position = 2| E", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "2| E" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.anciennement cadre = 2| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.anciennement cadre"), { + target: { value: "2| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/4 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.position = 3| F, G, H ou I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "3| F, G, H ou I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/4 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.âge = 4| 55 ans et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.âge"), { + target: { value: "4| 55 ans et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.position = 1| A, B, C ou D", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "1| A, B, C ou D" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.anciennement cadre = 2| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.anciennement cadre"), { + target: { value: "2| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.position = 2| E", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "2| E" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.anciennement cadre = 2| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.anciennement cadre"), { + target: { value: "2| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.position = 3| F, G, H ou I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.position"), { + target: { value: "3| F, G, H ou I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 47| Entre 3 ans et moins de 5 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "47| Entre 3 ans et moins de 5 ans" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 48| 5 ans ou plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "48| 5 ans ou plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/6 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 75.2.1/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/44.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/44.test.tsx new file mode 100644 index 0000000000..7c4265511b --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/44.test.tsx @@ -0,0 +1,821 @@ +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": 44, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "44" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.groupe = 6| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "6| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 11| Inférieur à 275", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "11| Inférieur à 275" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant 2, article 20/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.coefficient = 14| Supérieur à 275 (inclus)", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "14| Supérieur à 275 (inclus)" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant 2, article 20/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "1| I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 4| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "4| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 5| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "5| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 60| Ingénieurs, Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "60| Ingénieurs, Cadres" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 9| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "9| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°3 article 4/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 4| Ouvriers", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "4| Ouvriers" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "1| I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 4| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "4| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 5| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "5| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 28| Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "28| Techniciens" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "1| I" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 4| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "4| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 5| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "5| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 7| Inférieur à 190", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "7| Inférieur à 190" }, + }); + 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(/Avenant n°1 article 27/)[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(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.coefficient = 8| 190 et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "8| 190 et plus" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.groupe = 6| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "6| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 11| Inférieur à 275", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "11| Inférieur à 275" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant 2, article 20/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.coefficient = 14| Supérieur à 275 (inclus)", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "14| Supérieur à 275 (inclus)" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant 2, article 20/)[0] + ).toBeInTheDocument(); + }); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/573.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/573.test.tsx new file mode 100644 index 0000000000..908254c111 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/573.test.tsx @@ -0,0 +1,139 @@ +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": 573, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "573" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 21| Agents de maîtrise et Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "21| Agents de maîtrise et Techniciens" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35/)[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 35/)[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.motif de rupture = 2| Autre motif (hors faute grave ou lourde)", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.motif de rupture"), { + target: { value: "2| Autre motif (hors faute grave ou lourde)" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35/)[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 35/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.motif de rupture = 1| Motif économique", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.motif de rupture"), { + target: { value: "1| Motif économique" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 38/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/675.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/675.test.tsx new file mode 100644 index 0000000000..f38197c013 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/675.test.tsx @@ -0,0 +1,149 @@ +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": 675, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "675" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/article 9 de l'avenant « Maîtrise »/)[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 13 de l'avenant « Cadres »/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 3| Moins de 1 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "3| Moins de 1 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/Aucun préavis/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 38/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 14| 1 mois à moins de 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "14| 1 mois à moins de 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/15 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 38/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 33| 6 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "33| 6 mois à 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 38/)[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 38/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/787.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/787.test.tsx new file mode 100644 index 0000000000..211bebd3d3 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/787.test.tsx @@ -0,0 +1,73 @@ +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": 787, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "787" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 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 6.2.0/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 6.2.0/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/843.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/843.test.tsx new file mode 100644 index 0000000000..57aab4d7df --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/843.test.tsx @@ -0,0 +1,147 @@ +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": 843, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "843" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 48| Cadres", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "48| Cadres" }, + } + ); + 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 et demi/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe : Statut du personnel d'encadrement, article 6/ + )[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(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Annexe : Statut du personnel d'encadrement, article 6/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 35| Personnel de fabrication, personnel de vente et personnel de services", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { + value: + "35| Personnel de fabrication, personnel de vente et personnel de services", + }, + } + ); + 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(/1 semaine/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 32/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 34| Plus de 6 mois à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "34| Plus de 6 mois à 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 32/)[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 32/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/86.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/86.test.tsx new file mode 100644 index 0000000000..8d3c653b67 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/86.test.tsx @@ -0,0 +1,115 @@ +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": 86, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "86" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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 = 21| Agents de maîtrise et Techniciens", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "21| Agents de maîtrise et Techniciens" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 49/)[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 68/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 16| Employés", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "16| Employés" }, + } + ); + 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 30/)[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 30/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/898.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/898.test.tsx new file mode 100644 index 0000000000..adea05cb3d --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/898.test.tsx @@ -0,0 +1,199 @@ +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": 898, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "898" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + 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 24/)[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 24/)[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 24/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 24/)[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 24/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 24/)[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 24/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 24/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/article 24/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/914.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/914.test.tsx new file mode 100644 index 0000000000..bc5cd1310f --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisLicenciement/__tests__/agreements/914.test.tsx @@ -0,0 +1,199 @@ +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": 914, + "shortTitle": "shortTitle", + "id": "id", + "title": "title", + "url": "https://www.url.fr", + "slug": "914" + } + ` +); + +describe("DureePreavisLicenciement", () => { + beforeEach(() => { + render(); + 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.niveau = 1| I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "1| I" }, + }); + 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 52/)[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 52/)[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 52/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 52/)[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 52/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 4| III", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "4| III" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.ancienneté = 40| 2 ans ou moins", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "40| 2 ans ou moins" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 52/)[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 52/)[0]).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.niveau = 5| IV", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "5| IV" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 52/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.niveau = 7| V", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "7| V" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 52/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-modeles/src/simulators/preavis-licenciement/preavis-licenciement.data.json b/packages/code-du-travail-modeles/src/simulators/preavis-licenciement/preavis-licenciement.data.json index 52512217b6..b80cbf34a2 100644 --- a/packages/code-du-travail-modeles/src/simulators/preavis-licenciement/preavis-licenciement.data.json +++ b/packages/code-du-travail-modeles/src/simulators/preavis-licenciement/preavis-licenciement.data.json @@ -70,7 +70,8 @@ }, { "name": "anciennement cadre", - "question": "Le salarié était-il cadre dans son ancienne convention collective (avant le 01/01/2024) ?" + "question": "Le salarié était-il cadre dans l'ancienne convention collective de la métallurgie (avant le 01/01/2024) ?", + "note": "Si le salarié dépendait précédemment de la convention collective des ingénieurs et cadres de la métallurgie (IDCC 650) et qu’il est désormais classé non-cadre en raison de la nouvelle classification des emplois (depuis le 01/01/2024), il bénéficie quand même de la durée de préavis qui s’applique aux cadres." }, { "name": "groupe", @@ -107,11 +108,6 @@ { "name": "convention collective", "question": "Quelle est la convention collective du salarié ?" - }, - { - "name": "anciennement cadre", - "question": "Le salarié était-il cadre dans l'ancienne convention collective de la métallurgie (avant le 01/01/2024) ?", - "note": "Si l'emploi du salarié était précédemment cadre (en application de l’ancienne Convention collective - Ingénieurs et cadres (IDCC 650)) et qu’il est classé non-cadre à partir du 1er janvier 2024, en raison de la nouvelle classification des emplois, le salarié bénéficie de la durée de préavis qui s’applique aux cadres." } ], "situations": [ @@ -124,7 +120,7 @@ "typeRupture": null, "answer": "1 mois", "answer2": null, - "answer3": null, + "answer3": "30", "ref": "Article 46", "refUrl": "https://www.legifrance.gouv.fr/affichIDCCArticle.do;jsessionid=C82F1F97F72A0703119C7E8E78BB85F7.tpdila10v_3?idArticle=KALIARTI000005786645&cidTexte=KALITEXT000005652402&dateTexte=20090818" }, @@ -137,7 +133,7 @@ "typeRupture": null, "answer": "2 mois", "answer2": null, - "answer3": null, + "answer3": "60", "ref": "Article 46", "refUrl": "https://www.legifrance.gouv.fr/affichIDCCArticle.do;jsessionid=C82F1F97F72A0703119C7E8E78BB85F7.tpdila10v_3?idArticle=KALIARTI000005786645&cidTexte=KALITEXT000005652402&dateTexte=20090818" }, @@ -3908,19 +3904,6 @@ "ref": "Article 32", "refUrl": "https://www.legifrance.gouv.fr/affichIDCCArticle.do?idArticle=KALIARTI000023759231&cidTexte=KALITEXT000023759095" }, - { - "criteria": { - "catégorie professionnelle": "77| Négociateur VRP" - }, - "type": "préavis de Licenciement", - "idcc": 1527, - "typeRupture": null, - "answer": "2 mois", - "answer2": null, - "answer3": "60", - "ref": "Article 32", - "refUrl": "https://www.legifrance.gouv.fr/affichIDCCArticle.do?idArticle=KALIARTI000023759231&cidTexte=KALITEXT000023759095" - }, { "criteria": { "catégorie professionnelle": "77| Négociateur VRP",