Skip to content

Commit

Permalink
fixup! editoast: add on_stop_signal flag on train schedule v2
Browse files Browse the repository at this point in the history
  • Loading branch information
flomonster committed Apr 26, 2024
1 parent 7a3a040 commit e1d1488
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions editoast/editoast_schemas/src/train_schedule/schedule_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,24 @@ impl<'de> Deserialize<'de> for ScheduleItem {
})
}
}

#[cfg(test)]
mod tests {
use super::ScheduleItem;

use serde_json::from_str;
use serde_json::to_string;

#[test]
fn desserialize_schedule_item_error() {
let schedule_item = ScheduleItem {
at: "a".into(),
arrival: None,
stop_for: None,
on_stop_signal: true,
locked: false,
};
let invalid_str = to_string(&schedule_item).unwrap();
assert!(from_str::<ScheduleItem>(&invalid_str).is_err());
}
}

0 comments on commit e1d1488

Please sign in to comment.