@socialgouv/cdtn-utils 4.229.0 → 4.230.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const challenger_utils_1 = require("../challenger.utils");
4
+ const SMIC_HOURLY = 12.02;
5
+ test("smic_hourly", () => {
6
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_hourly", null, SMIC_HOURLY)).toBe(12.02);
7
+ });
8
+ test("smic_monthly_35h", () => {
9
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_monthly_35h", null, SMIC_HOURLY)).toBeCloseTo(1823.03, 2);
10
+ });
11
+ test("smic_monthly_custom with 30h/week", () => {
12
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_monthly_custom", "30", SMIC_HOURLY)).toBeCloseTo(1562.6, 2);
13
+ });
14
+ test("smic_annual", () => {
15
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_annual", null, SMIC_HOURLY)).toBeCloseTo(21876.4, 1);
16
+ });
17
+ test("smic_annual_custom_monthly with 160h/month", () => {
18
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_annual_custom_monthly", "160", SMIC_HOURLY)).toBeCloseTo(23078.4, 2);
19
+ });
20
+ test("smic_annual_custom_week with 30h/week", () => {
21
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_annual_custom_week", "30", SMIC_HOURLY)).toBeCloseTo(18751.2, 2);
22
+ });
23
+ test("smic_monthly_percent with 70%", () => {
24
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_monthly_percent", "70", SMIC_HOURLY)).toBeCloseTo(1276.12, 2);
25
+ });
26
+ test("smic_monthly_multiple with factor 2", () => {
27
+ expect((0, challenger_utils_1.computeChallengerReference)("smic_monthly_multiple", "2", SMIC_HOURLY)).toBeCloseTo(3646.07, 2);
28
+ });
@@ -1,5 +1,5 @@
1
1
  export declare const HOURS_PER_MONTH: number;
2
- export type ChallengerFormula = "smic_hourly" | "smic_monthly_35h" | "smic_monthly_custom" | "smic_annual" | "smic_monthly_percent" | "smic_monthly_multiple";
2
+ export type ChallengerFormula = "smic_hourly" | "smic_monthly_35h" | "smic_monthly_custom" | "smic_annual" | "smic_annual_custom_monthly" | "smic_annual_custom_week" | "smic_monthly_percent" | "smic_monthly_multiple";
3
3
  export declare const CHALLENGER_FORMULAS: {
4
4
  value: ChallengerFormula;
5
5
  label: string;
@@ -16,6 +16,16 @@ exports.CHALLENGER_FORMULAS = [
16
16
  paramLabel: "Nombre d'heures / semaine",
17
17
  },
18
18
  { value: "smic_annual", label: "SMIC annuel" },
19
+ {
20
+ value: "smic_annual_custom_monthly",
21
+ label: "SMIC annuel personnalisé (mois)",
22
+ paramLabel: "Nombre d'heures / mois",
23
+ },
24
+ {
25
+ value: "smic_annual_custom_week",
26
+ label: "SMIC annuel personnalisé (semaine)",
27
+ paramLabel: "Nombre d'heures / semaine",
28
+ },
19
29
  {
20
30
  value: "smic_monthly_percent",
21
31
  label: "% du SMIC mensuel",
@@ -41,6 +51,10 @@ function computeChallengerReference(formula, parameter, smicHourly) {
41
51
  return isNaN(param) ? 0 : smicHourly * ((param * 52) / 12);
42
52
  case "smic_annual":
43
53
  return smicHourly * exports.HOURS_PER_MONTH * 12;
54
+ case "smic_annual_custom_monthly":
55
+ return isNaN(param) ? 0 : smicHourly * param * 12;
56
+ case "smic_annual_custom_week":
57
+ return isNaN(param) ? 0 : smicHourly * param * 52;
44
58
  case "smic_monthly_percent":
45
59
  return isNaN(param) ? 0 : smicHourly * exports.HOURS_PER_MONTH * (param / 100);
46
60
  case "smic_monthly_multiple":
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "registry": "https://registry.npmjs.org/"
6
6
  },
7
- "version": "4.229.0",
7
+ "version": "4.230.0",
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",
10
10
  "types": "build/index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "pnpm format"
56
56
  ]
57
57
  },
58
- "gitHead": "0454f6d91d5c490d5822366a286e5a9176597d50"
58
+ "gitHead": "963b775a30d195475ea5a319d523be582ed9249e"
59
59
  }