From 6db4f07731e5ba66d934da7e029083c4d0d7f7b3 Mon Sep 17 00:00:00 2001 From: Victor Zeinstra Date: Wed, 23 Oct 2024 09:25:47 +0200 Subject: [PATCH] feat: 6188 ajout des tests UI pour le simu preavis de demission (#6190) * feat: add TU preavis demission * chore: update TU * chore: json updates * chore: update TU * chore: format --------- Co-authored-by: Victor --- .../__tests__/agreements/1043.test.tsx | 80 ++ .../__tests__/agreements/1090.test.tsx | 138 ++ .../__tests__/agreements/1147.test.tsx | 92 ++ .../__tests__/agreements/1266.test.tsx | 158 +++ .../__tests__/agreements/1351.test.tsx | 1227 +++++++++++++++++ .../__tests__/agreements/1404.test.tsx | 124 ++ .../__tests__/agreements/1480.test.tsx | 32 + .../__tests__/agreements/1483.test.tsx | 120 ++ .../__tests__/agreements/1486.test.tsx | 168 +++ .../__tests__/agreements/1501.test.tsx | 185 +++ .../__tests__/agreements/1505.test.tsx | 86 ++ .../__tests__/agreements/1516.test.tsx | 104 ++ .../__tests__/agreements/1517.test.tsx | 179 +++ .../__tests__/agreements/1518.test.tsx | 209 +++ .../__tests__/agreements/1527.test.tsx | 269 ++++ .../__tests__/agreements/1596.test.tsx | 70 + .../__tests__/agreements/1597.test.tsx | 70 + .../__tests__/agreements/16.test.tsx | 197 +++ .../__tests__/agreements/1606.test.tsx | 86 ++ .../__tests__/agreements/1672.test.tsx | 68 + .../__tests__/agreements/1702.test.tsx | 70 + .../__tests__/agreements/1740.test.tsx | 58 + .../__tests__/agreements/176.test.tsx | 144 ++ .../__tests__/agreements/1979.test.tsx | 198 +++ .../__tests__/agreements/1996.test.tsx | 68 + .../__tests__/agreements/2098.test.tsx | 80 ++ .../__tests__/agreements/2120.test.tsx | 66 + .../__tests__/agreements/2148.test.tsx | 114 ++ .../__tests__/agreements/2216.test.tsx | 86 ++ .../__tests__/agreements/2264.test.tsx | 164 +++ .../__tests__/agreements/2511.test.tsx | 86 ++ .../__tests__/agreements/2596.test.tsx | 195 +++ .../__tests__/agreements/2609.test.tsx | 56 + .../__tests__/agreements/2614.test.tsx | 60 + .../__tests__/agreements/275.test.tsx | 126 ++ .../__tests__/agreements/292.test.tsx | 88 ++ .../__tests__/agreements/2941.test.tsx | 195 +++ .../__tests__/agreements/3043.test.tsx | 177 +++ .../__tests__/agreements/3127.test.tsx | 64 + .../__tests__/agreements/3239.test.tsx | 171 +++ .../__tests__/agreements/3248.test.tsx | 104 ++ .../__tests__/agreements/44.test.tsx | 155 +++ .../__tests__/agreements/573.test.tsx | 80 ++ .../__tests__/agreements/675.test.tsx | 135 ++ .../__tests__/agreements/787.test.tsx | 62 + .../__tests__/agreements/843.test.tsx | 97 ++ .../__tests__/agreements/86.test.tsx | 80 ++ .../preavis-demission.data.json | 4 +- 48 files changed, 6643 insertions(+), 2 deletions(-) create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1043.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1090.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1147.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1266.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1351.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1404.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1480.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1483.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1486.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1501.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1505.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1516.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1517.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1518.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1527.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1596.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1597.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/16.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1606.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1672.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1702.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1740.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/176.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1979.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1996.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2098.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2120.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2148.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2216.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2264.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2511.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2596.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2609.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2614.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/275.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/292.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2941.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3043.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3127.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3239.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3248.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/44.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/573.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/675.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/787.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/843.test.tsx create mode 100644 packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/86.test.tsx diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1043.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1043.test.tsx new file mode 100644 index 0000000000..9234e582da --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1043.test.tsx @@ -0,0 +1,80 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + describe("criteria.logement = 1| Non-logé", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.logement"), { + target: { value: "1| Non-logé" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 21| Inférieur ou égal à 602", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "21| Inférieur ou égal à 602" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/8 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 14/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.coefficient = 22| Supérieur à 602", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "22| Supérieur à 602" }, + }); + 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.logement = 3| logés", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.logement"), { + target: { value: "3| logés" }, + }); + 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(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1090.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1090.test.tsx new file mode 100644 index 0000000000..55f0fa120b --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1090.test.tsx @@ -0,0 +1,138 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 de la convention collective/)[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 de la convention collective/)[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 de la convention collective/)[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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 2.12 de la convention collective/)[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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 2.12 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1147.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1147.test.tsx new file mode 100644 index 0000000000..48670fae9d --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1147.test.tsx @@ -0,0 +1,92 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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é = 23| 6 mois et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "23| 6 mois et plus" }, + }); + 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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1266.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1266.test.tsx new file mode 100644 index 0000000000..2a35e9e460 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1266.test.tsx @@ -0,0 +1,158 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 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(/1 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é = 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 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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1351.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1351.test.tsx new file mode 100644 index 0000000000..e0cd2c2802 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1351.test.tsx @@ -0,0 +1,1227 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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(/il n’y a pas de préavis à effectuer/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(/1 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(/il n’y a pas de préavis à effectuer/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(/1 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(/il n’y a pas de préavis à effectuer/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(/1 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é = 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é = 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é = 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(/1 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é = 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(/1 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é = 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(/1 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é = 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é = 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é = 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/DureePreavisDemission/__tests__/agreements/1404.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1404.test.tsx new file mode 100644 index 0000000000..a6370b80b2 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1404.test.tsx @@ -0,0 +1,124 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + describe("criteria.catégorie professionnelle = 24| Agents de maîtrise (niveau IV et V)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "24| Agents de maîtrise (niveau IV et 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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 52| Cadres (niveau VI et plus)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "52| Cadres (niveau VI 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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 10| Ouvriers, Employés (niveau III)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "10| Ouvriers, Employés (niveau III)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + 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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); + + describe("criteria.catégorie professionnelle = 7| Ouvriers, Employés (niveaux I et II)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "7| Ouvriers, Employés (niveaux I et II)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.niveau = 2| I à II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "2| I à II" }, + }); + 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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1480.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1480.test.tsx new file mode 100644 index 0000000000..83fed12be9 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1480.test.tsx @@ -0,0 +1,32 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + 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(); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1483.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1483.test.tsx new file mode 100644 index 0000000000..52d74a4a0e --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1483.test.tsx @@ -0,0 +1,120 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 du Chapitre II de la convention collective/ + )[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 du Chapitre II de la convention collective/ + )[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(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 14 du Chapitre Ier de la convention collective/ + )[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(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 14 du Chapitre Ier de la convention collective/ + )[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1486.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1486.test.tsx new file mode 100644 index 0000000000..e585d72dfd --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1486.test.tsx @@ -0,0 +1,168 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 21 de l'annexe relative aux enquêteurs/ + )[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é = 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.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.2 de la convention collective/)[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()); + }); + + 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(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 4.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.2 de la convention collective/)[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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1501.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1501.test.tsx new file mode 100644 index 0000000000..8fc013d978 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1501.test.tsx @@ -0,0 +1,185 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 = 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 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(/15 jours/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(/1 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 = 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(/8 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 12/)[0]).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 23| 6 mois et plus", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "23| 6 mois et plus" }, + }); + 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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1505.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1505.test.tsx new file mode 100644 index 0000000000..cdc3b069fe --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1505.test.tsx @@ -0,0 +1,86 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + describe("criteria.catégorie professionnelle = 25| Agents de maîtrise (AM1 et AM2)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "25| 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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 51| Cadres (C1 et C2)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "51| 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 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 11| Employés (E1 à E7)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "11| Employés (E1 à E7)" }, + } + ); + 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(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1516.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1516.test.tsx new file mode 100644 index 0000000000..cccc98dcef --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1516.test.tsx @@ -0,0 +1,104 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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/DureePreavisDemission/__tests__/agreements/1517.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1517.test.tsx new file mode 100644 index 0000000000..64c508b41a --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1517.test.tsx @@ -0,0 +1,179 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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()); + }); + + 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 = 3| II", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.niveau"), { + target: { value: "3| II" }, + }); + 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 = 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(/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()); + }); + + 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 = 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(/1 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()); + }); + + 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()); + }); + + 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()); + }); + + 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()); + }); + + 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/DureePreavisDemission/__tests__/agreements/1518.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1518.test.tsx new file mode 100644 index 0000000000..39845d4cc1 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1518.test.tsx @@ -0,0 +1,209 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 4.4/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1527.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1527.test.tsx new file mode 100644 index 0000000000..fa118f5bf3 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1527.test.tsx @@ -0,0 +1,269 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 = 56| Cadres non-VRP", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "56| Cadres non-VRP" }, + } + ); + 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 = 55| Cadres VRP", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "55| Cadres 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é = 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 = 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é = 37| 1 an à moins de 2 ans", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "37| 1 an à 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(/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/DureePreavisDemission/__tests__/agreements/1596.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1596.test.tsx new file mode 100644 index 0000000000..6e80014fc7 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1596.test.tsx @@ -0,0 +1,70 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + 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é = 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é = 13| Plus de 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "13| Plus de 3 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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1597.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1597.test.tsx new file mode 100644 index 0000000000..2043ae95f8 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1597.test.tsx @@ -0,0 +1,70 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + 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é = 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é = 13| Plus de 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "13| Plus de 3 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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/16.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/16.test.tsx new file mode 100644 index 0000000000..e8faacd01a --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/16.test.tsx @@ -0,0 +1,197 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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.personnel de conduite = 1| Oui", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.personnel de conduite"), { + target: { value: "1| Oui" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Accord du 18 avril 2002, article 30/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.personnel de conduite = 2| Non", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.personnel de conduite"), { + target: { value: "2| Non" }, + }); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.personnels des entreprises de transport routier de marchandises = 1| Oui", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId( + "criteria.personnels des entreprises de transport routier de marchandises" + ), + { + target: { value: "1| Oui" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Annexe I, chapitre Ier, article 5/)[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Accord du 3 février 2022, article 3/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.personnels des entreprises de transport routier de marchandises = 1| Non", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId( + "criteria.personnels des entreprises de transport routier de marchandises" + ), + { + target: { value: "1| Non" }, + } + ); + 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.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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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/DureePreavisDemission/__tests__/agreements/1606.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1606.test.tsx new file mode 100644 index 0000000000..0bcff575cd --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1606.test.tsx @@ -0,0 +1,86 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 8 de l'annexe "agents de 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 8 de l'annexe "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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 9.1 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1672.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1672.test.tsx new file mode 100644 index 0000000000..4fd7c1ee28 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1672.test.tsx @@ -0,0 +1,68 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + describe("criteria.catégorie professionnelle = 58| Cadres (Classes 5 à 7)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "58| Cadres (Classes 5 à 7)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article II. 6 de l'accord relatif aux dispositions particulières " Cadres "/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 36| Non-cadres (Classes 1 à 4)", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "36| Non-cadres (Classes 1 à 4)" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 91 a\) de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1702.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1702.test.tsx new file mode 100644 index 0000000000..1d0e02bd7c --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1702.test.tsx @@ -0,0 +1,70 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + 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é = 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é = 13| Plus de 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "13| Plus de 3 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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1740.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1740.test.tsx new file mode 100644 index 0000000000..4e818e729e --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1740.test.tsx @@ -0,0 +1,58 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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é = 13| Plus de 3 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "13| Plus de 3 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(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/176.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/176.test.tsx new file mode 100644 index 0000000000..abeace93ae --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/176.test.tsx @@ -0,0 +1,144 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 = 27| 4 à 5", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "27| 4 à 5" }, + }); + 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/DureePreavisDemission/__tests__/agreements/1979.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1979.test.tsx new file mode 100644 index 0000000000..31ab6cb799 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1979.test.tsx @@ -0,0 +1,198 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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é = 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 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 30 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 30 de la convention collective/)[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é = 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 de la convention collective/)[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(/Article 30 de la convention collective/)[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 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(/15 jours/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 30 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(/1 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/DureePreavisDemission/__tests__/agreements/1996.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1996.test.tsx new file mode 100644 index 0000000000..c4c048261d --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1996.test.tsx @@ -0,0 +1,68 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 de la convention collective nationale du 3 décembre 1997 relative aux dispositions particulières applicables 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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/DureePreavisDemission/__tests__/agreements/2098.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2098.test.tsx new file mode 100644 index 0000000000..71e834508f --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2098.test.tsx @@ -0,0 +1,80 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 19/)[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 19/)[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 19/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2120.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2120.test.tsx new file mode 100644 index 0000000000..2e502f1618 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2120.test.tsx @@ -0,0 +1,66 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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/DureePreavisDemission/__tests__/agreements/2148.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2148.test.tsx new file mode 100644 index 0000000000..198f53d368 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2148.test.tsx @@ -0,0 +1,114 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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é = 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.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/DureePreavisDemission/__tests__/agreements/2216.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2216.test.tsx new file mode 100644 index 0000000000..da487c7bd9 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2216.test.tsx @@ -0,0 +1,86 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/article 3 de l'annexe I/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2264.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2264.test.tsx new file mode 100644 index 0000000000..e08b7a7f49 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2264.test.tsx @@ -0,0 +1,164 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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é = 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(/15 jours/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 45/)[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(/1 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/DureePreavisDemission/__tests__/agreements/2511.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2511.test.tsx new file mode 100644 index 0000000000..3d6246327a --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2511.test.tsx @@ -0,0 +1,86 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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.1. de la convention collective/)[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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 4.4.1. de la convention collective/)[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 4.4.1. de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2596.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2596.test.tsx new file mode 100644 index 0000000000..054ad66fd3 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2596.test.tsx @@ -0,0 +1,195 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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é = 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(/1 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é = 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(/1 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é = 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(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 7.4.1/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2609.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2609.test.tsx new file mode 100644 index 0000000000..6a40dcf2ed --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2609.test.tsx @@ -0,0 +1,56 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 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(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2614.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2614.test.tsx new file mode 100644 index 0000000000..6112821261 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2614.test.tsx @@ -0,0 +1,60 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 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(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/275.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/275.test.tsx new file mode 100644 index 0000000000..6a7072634b --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/275.test.tsx @@ -0,0 +1,126 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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(/1 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 15, Annexe III/)[0] + ).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/292.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/292.test.tsx new file mode 100644 index 0000000000..1bef9169b9 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/292.test.tsx @@ -0,0 +1,88 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/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(/Article 15/)[0]).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2941.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2941.test.tsx new file mode 100644 index 0000000000..99f04796e7 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/2941.test.tsx @@ -0,0 +1,195 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 27/)[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 27/)[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 27/)[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 27/)[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 27/)[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 27/)[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 27/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3043.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3043.test.tsx new file mode 100644 index 0000000000..542bceada2 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3043.test.tsx @@ -0,0 +1,177 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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(/il n’y a pas de préavis à effectuer/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 4.11.2 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 16| 1 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "16| 1 mois à 6 mois" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 jours/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 4.11.2 de la convention collective/)[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(/1 semaine/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 4.11.2 de la convention collective/)[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 de la convention collective/)[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 4.11.2 de la convention collective/)[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 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.11.2 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3127.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3127.test.tsx new file mode 100644 index 0000000000..3fd6be03e6 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3127.test.tsx @@ -0,0 +1,64 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + 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 de la section 1 du Chapitre 4 de la Partie II 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 2 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/DureePreavisDemission/__tests__/agreements/3239.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3239.test.tsx new file mode 100644 index 0000000000..41588952c4 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3239.test.tsx @@ -0,0 +1,171 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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-6 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(/2 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 162-6 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(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 162-6 de la convention collective/)[0] + ).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/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Art. L. 423-26 du Code de l’action sociale et des familles/ + )[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Art. 120 de la convention collective/)[0] + ).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-26 du Code de l’action sociale et des familles/ + )[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Art. 120 de la convention collective/)[0] + ).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-26 du Code de l’action sociale et des familles/ + )[0] + ).toBeInTheDocument(); + expect( + screen.queryAllByText(/Art. 120 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3248.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3248.test.tsx new file mode 100644 index 0000000000..3d40802454 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/3248.test.tsx @@ -0,0 +1,104 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.get()); + + fireEvent.click(ui.next.get()); + }); + + describe("criteria.groupe = 1| A ou B", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "1| A ou B" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 semaines/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 74.2.1/)[0]).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + expect( + screen.queryAllByText( + /Cour de cassation, civile, Chambre sociale, 31 mars 2021, 19-20.883, Inédit/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 2| C", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "2| C" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 74.2.1/)[0]).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + expect( + screen.queryAllByText( + /Cour de cassation, civile, Chambre sociale, 31 mars 2021, 19-20.883, Inédit/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 3| D ou E", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "3| D ou E" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/2 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 74.2.1/)[0]).toBeInTheDocument(); + expect(screen.queryAllByText(/Article 68/)[0]).toBeInTheDocument(); + expect( + screen.queryAllByText( + /Cour de cassation, civile, Chambre sociale, 31 mars 2021, 19-20.883, Inédit/ + )[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.groupe = 4| F, G, H ou I", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.groupe"), { + target: { value: "4| F, G, H ou I" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/3 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 74.2.1/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/44.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/44.test.tsx new file mode 100644 index 0000000000..9260dd3c71 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/44.test.tsx @@ -0,0 +1,155 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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.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 = 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(/Avenant n°3 article 4/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.catégorie professionnelle = 14| Ouvriers et collaborateurs", () => { + beforeEach(() => { + fireEvent.change( + screen.getByTestId("criteria.catégorie professionnelle"), + { + target: { value: "14| Ouvriers et collaborateurs" }, + } + ); + fireEvent.click(ui.next.get()); + }); + + describe("criteria.coefficient = 1| Inférieur à 160", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "1| Inférieur à 160" }, + }); + fireEvent.click(ui.next.get()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/15 jours/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Avenant n°1 article 27/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.coefficient = 2| Entre 160 (inclus) et 175", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.coefficient"), { + target: { value: "2| Entre 160 (inclus) et 175" }, + }); + 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.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(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/573.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/573.test.tsx new file mode 100644 index 0000000000..e3a7e6b701 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/573.test.tsx @@ -0,0 +1,80 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 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()); + }); + + it("should display expected answer", () => { + expect(screen.queryAllByText(/1 mois/g)[0]).toBeInTheDocument(); + + expect(screen.queryAllByText(/Article 35/)[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 35/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/675.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/675.test.tsx new file mode 100644 index 0000000000..4646e9efb6 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/675.test.tsx @@ -0,0 +1,135 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 Convention collective nationale du 30 juin 1972/ + )[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 Convention collective nationale du 30 juin 1972/ + )[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(/il n’y a pas de préavis à effectuer/g)[0] + ).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 38 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + + describe("criteria.ancienneté = 16| 1 mois à 6 mois", () => { + beforeEach(() => { + fireEvent.change(screen.getByTestId("criteria.ancienneté"), { + target: { value: "16| 1 mois à 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 de la convention collective/)[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(/1 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 38 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/787.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/787.test.tsx new file mode 100644 index 0000000000..a5b024c6ea --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/787.test.tsx @@ -0,0 +1,62 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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/DureePreavisDemission/__tests__/agreements/843.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/843.test.tsx new file mode 100644 index 0000000000..5fc8128f67 --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/843.test.tsx @@ -0,0 +1,97 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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(/2 mois/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText( + /Article 6 de l'annexe : Statut du personnel d'encadrement/ + )[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 de la convention collective/)[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 semaines/g)[0]).toBeInTheDocument(); + + expect( + screen.queryAllByText(/Article 32 de la convention collective/)[0] + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/86.test.tsx b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/86.test.tsx new file mode 100644 index 0000000000..b69874bece --- /dev/null +++ b/packages/code-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/86.test.tsx @@ -0,0 +1,80 @@ +import { DureePreavisDemission } 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("DureePreavisDemission", () => { + beforeEach(() => { + render(); + fireEvent.click(ui.introduction.startButton.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 48/)[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 67/)[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 29/)[0]).toBeInTheDocument(); + }); + }); +}); diff --git a/packages/code-du-travail-modeles/src/simulators/preavis-demission/preavis-demission.data.json b/packages/code-du-travail-modeles/src/simulators/preavis-demission/preavis-demission.data.json index b2f73392d0..d5caf69b88 100644 --- a/packages/code-du-travail-modeles/src/simulators/preavis-demission/preavis-demission.data.json +++ b/packages/code-du-travail-modeles/src/simulators/preavis-demission/preavis-demission.data.json @@ -1957,7 +1957,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" }, @@ -3117,7 +3117,7 @@ "type": "préavis de Démission", "idcc": 3239, "typeRupture": null, - "answer": null, + "answer": "8 jours", "answer2": null, "answer3": "8", "refs": [