-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 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 <[email protected]>
- Loading branch information
Showing
48 changed files
with
6,643 additions
and
2 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...e-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1043.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(<DureePreavisDemission icon={""} title={""} displayTitle={""} />); | ||
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(); | ||
}); | ||
}); | ||
}); |
138 changes: 138 additions & 0 deletions
138
...e-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1090.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(<DureePreavisDemission icon={""} title={""} displayTitle={""} />); | ||
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(); | ||
}); | ||
}); | ||
}); | ||
}); |
92 changes: 92 additions & 0 deletions
92
...e-du-travail-frontend/src/outils/DureePreavisDemission/__tests__/agreements/1147.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(<DureePreavisDemission icon={""} title={""} displayTitle={""} />); | ||
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(); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.