Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(simulator): add retirement for CC 650 #3499

Merged
merged 1 commit into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Action, ActionName, State } from "../common/type/WizardType";
import Steps from "./steps";

// Add only idcc number for Agreement asking for additionnal information
const supportedCcn = [16, 29, 44, 176, 275, 292];

export const initialState: State = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function ResultStep({ form }: WizardStepProps): JSX.Element {
<>
<SectionTitle>Source</SectionTitle>
<ul>
{references.map(({ article, url }) => (
<li key={url}>
{references.map(({ article, url }, id) => (
<li key={`${url}-${id}`}>
<A11yLink
href={url}
target="_blank"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Engine from "publicodes";
import { mergeModels } from "../internal/merger";
import { getReferences } from "../utils/GetReferences";
import {
DepartRetraiteReferences,
MiseRetraiteReferences,
} from "./common/LegalReferences";

const engine = new Engine(mergeModels());

const MiseRetraiteMetallurgieReferences = [
{
article: "Article 32.2",
url:
"https://www.legifrance.gouv.fr/conv_coll/id/KALIARTI000023173750/?idConteneur=KALICONT000005635842",
},
];
const DepartRetraiteMetallurgieReferences = [
{
article: "Article 31.2",
url:
"https://www.legifrance.gouv.fr/conv_coll/id/KALIARTI000023173739/?idConteneur=KALICONT000005635842",
},
];

test("Vérification des références juridiques pour un employé en départ à la retraite", () => {
const result = getReferences(
engine.setSituation({
"contrat salarié . convention collective": "'IDCC0650'",
"contrat salarié . ancienneté": 6,
"contrat salarié . mise à la retraite": "non",
})
);

expect(result).toEqual(
expect.arrayContaining(
DepartRetraiteReferences.concat(DepartRetraiteMetallurgieReferences)
)
);
});

test("Vérification des références juridiques pour un employé en mise à la retraite", () => {
const result = getReferences(
engine.setSituation({
"contrat salarié . convention collective": "'IDCC0650'",
"contrat salarié . ancienneté": 6,
"contrat salarié . mise à la retraite": "oui",
})
);

expect(result).toEqual(
expect.arrayContaining(
MiseRetraiteReferences.concat(MiseRetraiteMetallurgieReferences)
)
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import Engine from "publicodes";
import { mergeModels } from "../internal/merger";
import { getNotifications } from "../utils/GetNotifications";

const engine = new Engine(mergeModels());

test.each`
seniority | expectedNotice
${3} | ${1}
${6} | ${1}
${24} | ${2}
`(
"Pour un employé possédant $seniority mois d'ancienneté, son préavis de mise à la retraite devrait être $expectedNotice mois",
({ seniority, expectedNotice }) => {
const result = engine
.setSituation({
"contrat salarié . ancienneté": seniority,
"contrat salarié . convention collective": "'IDCC0650'",
"contrat salarié . mise à la retraite": "oui",
})
.evaluate("contrat salarié . préavis de retraite");

expect(result.nodeValue).toEqual(expectedNotice);
expect(result.unit?.numerators).toEqual(["mois"]);
}
);

test.each`
seniority | expectedNotice
${3} | ${1}
${6} | ${1}
${24} | ${2}
`(
"Pour un employé possédant $seniority mois d'ancienneté, son préavis de départ à la retraite devrait être $expectedNotice mois",
({ seniority, expectedNotice }) => {
const result = engine
.setSituation({
"contrat salarié . ancienneté": seniority,
"contrat salarié . convention collective": "'IDCC0650'",
"contrat salarié . mise à la retraite": "non",
})
.evaluate("contrat salarié . préavis de retraite");

expect(result.nodeValue).toEqual(expectedNotice);
expect(result.unit?.numerators).toEqual(["mois"]);
}
);

test.each`
seniority
${3}
${6}
${24}
`(
"Pour une employée avec une anciénneté de $seniority lors d'un départ à la retraite, on attend une notification",
({ seniority, expectedNotification }) => {
const notifications = getNotifications(
engine.setSituation({
"contrat salarié . convention collective": "'IDCC0650'",
"contrat salarié . ancienneté": seniority,
"contrat salarié . mise à la retraite": "non",
})
);

expect(notifications).toHaveLength(1);
expect(notifications[0].description).toEqual(
"L'ancienneté se calcule à la date de notification du départ à la retraite."
);
}
);

test.each`
seniority
${3}
${6}
${24}
`(
"Pour une employée avec une anciénneté de $seniority lors d'une mise à la retraite, on attend une notification",
({ seniority, expectedNotification }) => {
const notifications = getNotifications(
engine.setSituation({
"contrat salarié . convention collective": "'IDCC0650'",
"contrat salarié . ancienneté": seniority,
"contrat salarié . mise à la retraite": "oui",
})
);

expect(notifications).toHaveLength(1);
expect(notifications[0].description).toEqual(
"L'ancienneté se calcule à la date de notification du départ à la retraite."
);
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Convention collective nationale métallurgie ingénieurs et cadres

contrat salarié . convention collective . métallurgie ingénieurs et cadres:
description: Convention collective nationale métallurgie ingénieurs et cadres
applicable si: convention collective = 'IDCC0650'
valeur: oui


contrat salarié . convention collective . métallurgie ingénieurs et cadres . mise à la retraite:
applicable si: mise à la retraite
remplace: préavis de retraite collective
grille:
assiette: ancienneté
tranches:
- montant: 1 mois
plafond: 24 mois
- montant: 2 mois
références:
Article 32.2: https://www.legifrance.gouv.fr/conv_coll/id/KALIARTI000023173750/?idConteneur=KALICONT000005635842

contrat salarié . convention collective . métallurgie ingénieurs et cadres . départ à la retraite:
applicable si: départ à la retraite
remplace: préavis de retraite collective
grille:
assiette: ancienneté
tranches:
- montant: 1 mois
plafond: 24 mois
- montant: 2 mois
références:
Article 31.2: https://www.legifrance.gouv.fr/conv_coll/id/KALIARTI000023173739/?idConteneur=KALICONT000005635842

contrat salarié . convention collective . métallurgie ingénieurs et cadres . notification:
type: notification
description: L'ancienneté se calcule à la date de notification du départ à la retraite.
valeur: oui


99 changes: 57 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,10 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@hapi/[email protected].1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@hapi/accept/-/accept-5.0.1.tgz#068553e867f0f63225a506ed74e899441af53e10"
integrity sha512-fMr4d7zLzsAXo28PRRQPXR1o2Wmu+6z+VY1UzDp0iFo13Twj8WePakwXBiqn3E1aAlTpSNzCXdnnQXFhst8h8Q==
"@hapi/[email protected].2":
version "5.0.2"
resolved "https://registry.yarnpkg.com/@hapi/accept/-/accept-5.0.2.tgz#ab7043b037e68b722f93f376afb05e85c0699523"
integrity sha512-CmzBx/bXUR8451fnZRuZAJRlzgm0Jgu5dltTX/bszmR2lheb9BpyN47Q1RbaGTsvFzn0PXAEs+lXDKfshccYZw==
dependencies:
"@hapi/boom" "9.x.x"
"@hapi/hoek" "9.x.x"
Expand Down Expand Up @@ -2147,20 +2147,20 @@
dependencies:
webpack-bundle-analyzer "4.3.0"

"@next/[email protected].0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/env/-/env-10.2.0.tgz#154dbce2efa3ad067ebd20b7d0aa9aed775e7c97"
integrity sha512-tsWBsn1Rb6hXRaHc/pWMCpZ4Ipkf3OCbZ54ef5ukgIyEvzzGdGFXQshPP2AF7yb+8yMpunWs7vOMZW3e8oPF6A==
"@next/[email protected].1":
version "10.2.1"
resolved "https://registry.yarnpkg.com/@next/env/-/env-10.2.1.tgz#f8b088db5b071d7b817bce200c2a0b51195e8bba"
integrity sha512-mvUCIrwxFfyQa24iTbYAW1fbToC7cW4cGW5oiR3AyE6clfGK6fzwbkdODtjfaHGmCCS4K0epsy/XgV6DJS/EIw==

"@next/[email protected].0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.2.0.tgz#61f41110c4b465cc26d113e2054e205df61c3594"
integrity sha512-Nl3GexIUXsmuggkUqrRFyE/2k7UI44JaVzSywtXEyHzxpZm2a5bdMaWuC89pgLiFDDOqmbqyLAbtwm5lNxa7Eg==
"@next/[email protected].1":
version "10.2.1"
resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.2.1.tgz#21d6dc4e32c3117bda16991840afbb0d00119c09"
integrity sha512-MNVwR3lzZuH/UsLxclLeNXhd9GGvqjavMtAx8zSbOHzZHPmEYw3EQRqUI0qCNUdX52N+aSPeAhvDjUUzHdCpsA==

"@next/[email protected].0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.2.0.tgz#4220121abac7e3404cbaf467784aeecca8be46cf"
integrity sha512-PRIAoWog41hLN4iJ8dChKp4ysOX0Q8yiNQ/cwzyqEd3EjugkDV5OiKl3mumGKaApJaIra1MX6j1wgQRuLhuWMA==
"@next/[email protected].1":
version "10.2.1"
resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.2.1.tgz#274860ff4d03c48a6ae910a0ed2bb50f67f17c84"
integrity sha512-ZCSPO/gyJio9jBnF4Z+f+WMfMiIAgVjxyZ9h81W1Fjd/5BwoAADxakyCdXiLCMlVXkgtO1dXkY+yXTegxkpASQ==
dependencies:
"@babel/code-frame" "7.12.11"
anser "1.4.9"
Expand All @@ -2174,10 +2174,10 @@
stacktrace-parser "0.1.10"
strip-ansi "6.0.0"

"@next/[email protected].0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.2.0.tgz#55953b697769c6647f371bc6bcd865a24e1a22e9"
integrity sha512-3I31K9B4hEQRl7yQ44Umyz+szHtuMJrNdwsgJGhoEnUCXSBRHp5wv5Zv8eDa2NewSbe53b2C0oOpivrzmdBakw==
"@next/[email protected].1":
version "10.2.1"
resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.2.1.tgz#f7c882aad353cad7fe042cb4d692e21439d003f5"
integrity sha512-G7l/1kQqTzZ1k6cw6WQol8F0eA7S+YQhUep4eTwlTI6k7Zei1f6/NuSbed9XxEH6xBB/bjVTaxxf0dYpBeB7zA==

"@nodelib/[email protected]":
version "2.1.4"
Expand Down Expand Up @@ -5319,16 +5319,16 @@ [email protected]:
escalade "^3.0.2"
node-releases "^1.1.61"

[email protected].1:
version "4.16.1"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.1.tgz#bf757a2da376b3447b800a16f0f1c96358138766"
integrity sha512-UXhDrwqsNcpTYJBTZsbGATDxZbiVDsx6UjpmRUmtnP10pr8wAYr5LgFoEFw9ixriQH2mv/NX2SfGzE/o8GndLA==
[email protected].6:
version "4.16.6"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.6.tgz#d7901277a5a88e554ed305b183ec9b0c08f66fa2"
integrity sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==
dependencies:
caniuse-lite "^1.0.30001173"
colorette "^1.2.1"
electron-to-chromium "^1.3.634"
caniuse-lite "^1.0.30001219"
colorette "^1.2.2"
electron-to-chromium "^1.3.723"
escalade "^3.1.1"
node-releases "^1.1.69"
node-releases "^1.1.71"

browserslist@^4.12.0, browserslist@^4.14.5, browserslist@^4.16.3:
version "4.16.3"
Expand Down Expand Up @@ -5678,7 +5678,7 @@ camelize@^1.0.0:
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=

caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001181:
caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001181:
version "1.0.30001199"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001199.tgz#062afccaad21023e2e647d767bac4274b8b8fd7f"
integrity sha512-ifbK2eChUCFUwGhlEzIoVwzFt1+iriSjyKKFYNfv6hN34483wyWpLLavYQXhnR036LhkdUYaSDpHg1El++VgHQ==
Expand All @@ -5688,6 +5688,11 @@ caniuse-lite@^1.0.30001202:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001219.tgz#5bfa5d0519f41f993618bd318f606a4c4c16156b"
integrity sha512-c0yixVG4v9KBc/tQ2rlbB3A/bgBFRvl8h8M4IeUbqCca4gsiCfvtaheUssbnux/Mb66Vjz7x8yYjDgYcNQOhyQ==

caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001228:
version "1.0.30001228"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz#bfdc5942cd3326fa51ee0b42fbef4da9d492a7fa"
integrity sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==

capture-exit@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4"
Expand Down Expand Up @@ -7416,11 +7421,16 @@ elastic-apm-node@^3.12.1:
traverse "^0.6.6"
unicode-byte-truncate "^1.0.0"

electron-to-chromium@^1.3.564, electron-to-chromium@^1.3.634, electron-to-chromium@^1.3.649:
electron-to-chromium@^1.3.564, electron-to-chromium@^1.3.649:
version "1.3.687"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.687.tgz#c336184b7ab70427ffe2ee79eaeaedbc1ad8c374"
integrity sha512-IpzksdQNl3wdgkzf7dnA7/v10w0Utf1dF2L+B4+gKrloBrxCut+au+kky3PYvle3RMdSxZP+UiCZtLbcYRxSNQ==

electron-to-chromium@^1.3.723:
version "1.3.735"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.735.tgz#fa1a8660f2790662291cb2136f0e446a444cdfdc"
integrity sha512-cp7MWzC3NseUJV2FJFgaiesdrS+A8ZUjX5fLAxdRlcaPDkaPGFplX930S5vf84yqDp4LjuLdKouWuVOTwUfqHQ==

element-resize-detector@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/element-resize-detector/-/element-resize-detector-1.2.1.tgz#b0305194447a4863155e58f13323a0aef30851d1"
Expand Down Expand Up @@ -12817,24 +12827,24 @@ next-transpile-modules@^6.3.0:
enhanced-resolve "^5.7.0"
escalade "^3.1.1"

[email protected].0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/next/-/next-10.2.0.tgz#6654cc925d8abcb15474fa062fc6b3ee527dd6dc"
integrity sha512-PKDKCSF7s82xudu3kQhOEaokxggpbLEWouEUtzP6OqV0YqKYHF+Ff+BFLycEem8ixtTM2M6ElN0VRJcskJfxPQ==
[email protected].1:
version "10.2.1"
resolved "https://registry.yarnpkg.com/next/-/next-10.2.1.tgz#6a50b331c0a5e265c5756cfde9b9cec231ada76c"
integrity sha512-2xJx8vFVBxfEoMz1nrUnH/IN5Q1YKw/8MIOPlwmjUWQTYrDyNc4ldmm/4kWatDMgus6Sd2LVGo3RA5eKGOD1aQ==
dependencies:
"@babel/runtime" "7.12.5"
"@hapi/accept" "5.0.1"
"@next/env" "10.2.0"
"@next/polyfill-module" "10.2.0"
"@next/react-dev-overlay" "10.2.0"
"@next/react-refresh-utils" "10.2.0"
"@hapi/accept" "5.0.2"
"@next/env" "10.2.1"
"@next/polyfill-module" "10.2.1"
"@next/react-dev-overlay" "10.2.1"
"@next/react-refresh-utils" "10.2.1"
"@opentelemetry/api" "0.14.0"
assert "2.0.0"
ast-types "0.13.2"
browserify-zlib "0.2.0"
browserslist "4.16.1"
browserslist "4.16.6"
buffer "5.6.0"
caniuse-lite "^1.0.30001179"
caniuse-lite "^1.0.30001228"
chalk "2.4.2"
chokidar "3.5.1"
constants-browserify "1.0.0"
Expand Down Expand Up @@ -13017,11 +13027,16 @@ node-notifier@^8.0.0:
uuid "^8.3.0"
which "^2.0.2"

node-releases@^1.1.61, node-releases@^1.1.69, node-releases@^1.1.70:
node-releases@^1.1.61, node-releases@^1.1.70:
version "1.1.71"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb"
integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==

node-releases@^1.1.71:
version "1.1.72"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.72.tgz#14802ab6b1039a79a0c7d662b610a5bbd76eacbe"
integrity sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw==

nodemon@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.7.tgz#6f030a0a0ebe3ea1ba2a38f71bf9bab4841ced32"
Expand Down