Skip to content

Commit

Permalink
front: add categories to e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: hamz2a <[email protected]>
  • Loading branch information
hamz2a committed Feb 18, 2025
1 parent bf88b05 commit 17f06d3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
5 changes: 2 additions & 3 deletions editoast/src/models/rolling_stock_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,10 @@ impl RollingStockModelChangeset {
if other_categories
.iter()
.flatten()
.collect::<Vec<_>>()
.contains(&primary_category)
.any(|category| category == primary_category)
{
let mut error = ValidationError::new("primary_category");
error.message = Some("The primary_category cannot be listed in other_categories for rolling stocks.".into(),);
error.message = Some("The primary_category cannot be listed in other_categories for rolling stocks.".into());
validation_errors.add("primary_category", error);
}
}
Expand Down
6 changes: 4 additions & 2 deletions front/tests/assets/rollingStock/dual-mode_rolling_stock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"railjson_version": "3.2",
"railjson_version": "3.3",
"name": "DUAL-MODE_RS_E2Ee",
"effort_curves": {
"modes": {
Expand Down Expand Up @@ -440,5 +440,7 @@
"raise_pantograph_time": 16.0,
"version": 1,
"supported_signaling_systems": ["BAL", "BAPR", "TVM300", "TVM430"],
"liveries": []
"liveries": [],
"primary_category": "FREIGHT_TRAIN",
"other_categories": []
}
6 changes: 4 additions & 2 deletions front/tests/assets/rollingStock/fast_rolling_stock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": 480,
"railjson_version": "3.2",
"railjson_version": "3.3",
"name": "fast_rolling_stock",
"effort_curves": {
"modes": {
Expand Down Expand Up @@ -116,5 +116,7 @@
"raise_pantograph_time": null,
"version": 1,
"supported_signaling_systems": ["BAL", "BAPR"],
"liveries": []
"liveries": [],
"primary_category": "FREIGHT_TRAIN",
"other_categories": []
}
6 changes: 4 additions & 2 deletions front/tests/assets/rollingStock/improbable_rolling_stock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": 789,
"railjson_version": "3.2",
"railjson_version": "3.3",
"name": "IMPROBABLE_RS_E2E",
"effort_curves": {
"modes": {
Expand Down Expand Up @@ -938,5 +938,7 @@
"raise_pantograph_time": 15.0,
"version": 0,
"supported_signaling_systems": ["BAL", "BAPR", "TVM300", "TVM430"],
"liveries": []
"liveries": [],
"primary_category": "FREIGHT_TRAIN",
"other_categories": []
}
6 changes: 4 additions & 2 deletions front/tests/assets/rollingStock/slow_rolling_stock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": 479,
"railjson_version": "3.2",
"railjson_version": "3.3",
"name": "slow_rolling_stock",
"effort_curves": {
"modes": {
Expand Down Expand Up @@ -75,5 +75,7 @@
"raise_pantograph_time": null,
"version": 1,
"supported_signaling_systems": ["BAL", "BAPR"],
"liveries": []
"liveries": [],
"primary_category": "FREIGHT_TRAIN",
"other_categories": []
}

0 comments on commit 17f06d3

Please sign in to comment.