Skip to content

Commit

Permalink
update expected stderr strings to fix tests (#253)
Browse files Browse the repository at this point in the history
Updates a couple of tests to match error messages.
  • Loading branch information
minikin committed Jan 31, 2023
2 parents e66fb3c + 146e928 commit ba1251e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/jormungandr/jormungandr/src/context/mod.rs
Expand Up @@ -160,4 +160,6 @@ pub struct FullContext {
pub leadership_logs: LeadershipLogs,
pub enclave: Enclave,
pub network_state: NetworkStateR,
#[cfg(feature = "prometheus-metrics")]
pub prometheus: Option<Arc<crate::metrics::backends::Prometheus>>,
}
2 changes: 2 additions & 0 deletions src/jormungandr/jormungandr/src/lib.rs
Expand Up @@ -315,6 +315,8 @@ fn start_services(bootstrapped_node: BootstrappedNode) -> Result<(), start_up::E
leadership_logs,
enclave,
network_state,
#[cfg(feature = "prometheus-metrics")]
prometheus: prometheus_metric,
};
block_on(async {
let mut context = context.write().await;
Expand Down
Expand Up @@ -61,6 +61,6 @@ pub fn test_from_bytes_for_unknown_key() {
jcli.key().convert_from_bytes_string_expect_fail(
"ed25519-exten",
byte_key_file.path(),
"'ed25519-exten' isn't a valid value for '--type <KEY_TYPE>'",
"invalid value 'ed25519-exten' for '--type <KEY_TYPE>'",
);
}
Expand Up @@ -38,10 +38,8 @@ pub fn test_sumed25519_12_key_generation() {
#[test]
pub fn test_unknown_key_type_generation() {
let jcli: JCli = Default::default();
jcli.key().generate_expect_fail(
"unknown",
"'unknown' isn't a valid value for '--type <KEY_TYPE>'",
);
jcli.key()
.generate_expect_fail("unknown", "invalid value 'unknown' for '--type <KEY_TYPE>'");
}

#[test]
Expand Down
Expand Up @@ -8,7 +8,7 @@ pub fn test_correct_error_is_returned_for_incorrect_host_syntax() {

jcli.rest().v0().tip_expect_fail(
incorrect_host,
"Invalid value 'not_a_correct_syntax' for '--host <HOST>': relative URL without a base",
"invalid value 'not_a_correct_syntax' for '--host <HOST>': relative URL without a base",
);
}

Expand Down
Expand Up @@ -13,26 +13,33 @@ const FAKE_GENESIS_HASH: &str = "19c9852ca0a68f15d0f7de5d1a26acd67a3a3251640c606
#[test]
pub fn test_cannot_create_input_with_negative_amount() {
let jcli: JCli = Default::default();
const INVALID_VALUE: &str = "-1";
let expected_stderr_str = format!("error: unexpected argument '{}' found", INVALID_VALUE);
jcli.transaction_builder(Hash::from_hex(FAKE_GENESIS_HASH).unwrap())
.new_transaction()
.add_input_expect_fail(
&FAKE_INPUT_TRANSACTION_ID,
0,
"-100",
"Found argument '-1' which wasn't expected",
INVALID_VALUE,
&expected_stderr_str,
);
}

#[test]
pub fn test_cannot_create_input_with_too_big_utxo_amount() {
let jcli: JCli = Default::default();
const INVALID_VALUE: &str = "100000000000000000000";
let expected_stderr_str = format!(
"error: invalid value '{}' for '<VALUE>': number too large to fit in target type",
INVALID_VALUE
);
jcli.transaction_builder(Hash::from_hex(FAKE_GENESIS_HASH).unwrap())
.new_transaction()
.add_input_expect_fail(
&FAKE_INPUT_TRANSACTION_ID,
0,
"100000000000000000000",
"error: Invalid value '100000000000000000000' for '<VALUE>': number too large to fit in target type",
INVALID_VALUE,
&expected_stderr_str,
);
}

Expand Down

0 comments on commit ba1251e

Please sign in to comment.