Skip to content

Commit

Permalink
fix(octez): set default network for run options
Browse files Browse the repository at this point in the history
  • Loading branch information
huancheng-trili committed Nov 8, 2024
1 parent 2f06ee4 commit 5548172
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion crates/octez/src/async/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Display for OctezNodeHistoryMode {
}
}

#[derive(Default, Clone, PartialEq, Debug)]
#[derive(Clone, PartialEq, Debug)]
pub struct OctezNodeRunOptions {
synchonisation_threshold: u8,
network: String,
Expand All @@ -53,6 +53,16 @@ impl Display for OctezNodeRunOptions {
}
}

impl Default for OctezNodeRunOptions {
fn default() -> Self {
Self {
network: DEFAULT_NETWORK.to_owned(),
synchonisation_threshold: 0,
history_mode: None,
}
}
}

#[derive(Default)]
pub struct OctezNodeRunOptionsBuilder {
synchonisation_threshold: Option<u8>,
Expand Down Expand Up @@ -254,6 +264,14 @@ mod tests {
assert_eq!(run_options.synchonisation_threshold, 0);
}

#[test]
fn run_option_default() {
let run_options = OctezNodeRunOptions::default();
assert!(run_options.history_mode.is_none());
assert_eq!(run_options.network, "sandbox");
assert_eq!(run_options.synchonisation_threshold, 0);
}

#[test]
fn run_option_to_string() {
let mut run_options_builder = OctezNodeRunOptionsBuilder::new();
Expand Down

0 comments on commit 5548172

Please sign in to comment.