Skip to content

Commit 05d36e3

Browse files
fix: improve Status tests
1 parent b597a09 commit 05d36e3

File tree

3 files changed

+293
-31
lines changed

3 files changed

+293
-31
lines changed

pacaya/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ warp = { workspace = true }
3838

3939
[features]
4040
default = ["get_status_duration"]
41+
test = []
4142
get_status_duration = []
4243

4344
[dev-dependencies]

pacaya/src/node/operator/status.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[cfg(feature = "get_status_duration")]
2+
#[cfg_attr(test, derive(Debug))]
23
pub struct StatusCheckDurations {
34
pub check_taiko_wrapper: std::time::Duration,
45
pub check_handover_window_slots: std::time::Duration,
@@ -12,6 +13,7 @@ pub struct StatusCheckDurations {
1213
pub check_end_of_sequencing: std::time::Duration,
1314
}
1415

16+
#[cfg_attr(test, derive(Debug))]
1517
pub struct Status {
1618
preconfer: bool,
1719
submitter: bool,
@@ -22,6 +24,17 @@ pub struct Status {
2224
durations: Option<StatusCheckDurations>,
2325
}
2426

27+
#[cfg(test)]
28+
impl PartialEq for Status {
29+
fn eq(&self, other: &Self) -> bool {
30+
self.preconfer == other.preconfer
31+
&& self.submitter == other.submitter
32+
&& self.preconfirmation_started == other.preconfirmation_started
33+
&& self.end_of_sequencing == other.end_of_sequencing
34+
&& self.is_driver_synced == other.is_driver_synced
35+
}
36+
}
37+
2538
impl Status {
2639
pub fn new(
2740
preconfer: bool,

0 commit comments

Comments
 (0)