Skip to content

Commit

Permalink
[Fix TRA-13926] Ajout d'un sous-type "Regroupement" pour le BSFF dans…
Browse files Browse the repository at this point in the history
… le registre (#3371)
  • Loading branch information
GaelFerrand authored Jun 3, 2024
1 parent 55adebd commit 145069c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion back/src/bsffs/__tests__/registry.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe("getSubType", () => {
it.each([
[BsffType.COLLECTE_PETITES_QUANTITES, "INITIAL"],
[BsffType.TRACER_FLUIDE, "INITIAL"],
[BsffType.GROUPEMENT, "GATHERING"],
[BsffType.GROUPEMENT, "GROUPEMENT"],
[BsffType.RECONDITIONNEMENT, "RECONDITIONNEMENT"],
[BsffType.REEXPEDITION, "RESHIPMENT"]
])("type is %p > should return %p", async (type, expectedSubType) => {
Expand Down
2 changes: 1 addition & 1 deletion back/src/bsffs/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function getRegistryFields(

export const getSubType = (bsff: RegistryBsff): BsdSubType => {
if (bsff.type === "GROUPEMENT") {
return "GATHERING";
return "GROUPEMENT";
} else if (bsff.type === "RECONDITIONNEMENT") {
return "RECONDITIONNEMENT";
} else if (bsff.type === "REEXPEDITION") {
Expand Down
30 changes: 28 additions & 2 deletions back/src/registry/__tests__/columns.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IncomingWaste } from "../../generated/graphql/types";
import { CUSTOM_WASTE_COLUMNS, formatRow } from "../columns";
import { BsdSubType, IncomingWaste } from "../../generated/graphql/types";
import { CUSTOM_WASTE_COLUMNS, formatRow, formatSubType } from "../columns";

describe("formatRow", () => {
it("should format waste", () => {
Expand Down Expand Up @@ -115,3 +115,29 @@ describe("formatRow", () => {
);
});
});

describe("formatSubType", () => {
it.each([
[null, ""],
[undefined, ""],
["", ""],
["NOT_A_BSD_SUBTYPE", ""],
["INITIAL", "Initial"],
["TOURNEE", "Tournée dédiée"],
["APPENDIX1", "Annexe 1"],
["APPENDIX2", "Annexe 2"],
["TEMP_STORED", "Entreposage provisoire"],
["COLLECTION_2710", "Collecte en déchetterie"],
["GATHERING", "Groupement"],
["GROUPEMENT", "Regroupement"],
["RESHIPMENT", "Réexpédition"],
["RECONDITIONNEMENT", "Reconditionnement"],
["SYNTHESIS", "Synthèse"]
])("%p should return %p", (input, expected) => {
// When
const result = formatSubType(input as BsdSubType);

// Then
expect(result).toEqual(expected);
});
});
4 changes: 3 additions & 1 deletion back/src/registry/columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const formatFinalOperations = (val?: string[]) =>
val ? val.map(quant => quant.replace(/ /g, "")).join("; ") : ""; // be consistent and remove all white spaces
const formatFinalOperationWeights = (val?: number[]) =>
val ? val.map(quant => quant.toFixed(2)).join("; ") : "";
const formatSubType = (subType?: BsdSubType) => {
export const formatSubType = (subType?: BsdSubType) => {
if (!subType) return "";

switch (subType) {
Expand All @@ -72,6 +72,8 @@ const formatSubType = (subType?: BsdSubType) => {
return "Collecte en déchetterie";
case "GATHERING":
return "Groupement";
case "GROUPEMENT":
return "Regroupement";
case "RESHIPMENT":
return "Réexpédition";
case "RECONDITIONNEMENT":
Expand Down
3 changes: 3 additions & 0 deletions back/src/registry/typeDefs/registry.enums.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ enum BsdSubType {
"Groupement"
GATHERING

"Regroupement"
GROUPEMENT

"Réexpédition"
RESHIPMENT

Expand Down

0 comments on commit 145069c

Please sign in to comment.