add FragmentsProcessingSummary (nb: legacy node failing)
@@ -2,8 +2,7 @@ use crate::common::jcli::command::rest::v0::MessageCommand;
use assert_cmd::assert::OutputAssertExt;
use assert_fs::{fixture::FileWriteStr, NamedTempFile};
use chain_impl_mockchain::fragment::FragmentId;
-use jormungandr_lib::interfaces::FragmentLog;
-use jormungandr_testing_utils::testing::process::ProcessOutput as _;
+use jormungandr_lib::interfaces::{FragmentLog, FragmentsProcessingSummary};
use jortestkit::prelude::ProcessOutput;
pub struct Message {
@@ -19,14 +18,23 @@ impl Message {
let transaction_file = NamedTempFile::new("transaction.hash").unwrap();
transaction_file.write_str(fragment).unwrap();
- self.message_command
+ let response = self
+ .message_command
.post(transaction_file.path(), host.into())
.build()
.assert()
.success()
.get_output()
- .as_hash()
- .into_hash()
+ .as_single_line();
+
+ let summary: FragmentsProcessingSummary =
+ serde_json::from_str(&response).expect("not a valid json");
+ summary.accepted.get(0).cloned().unwrap_or_else(|| {
+ panic!(
+ "the fragment was rejected by the node: {:?}",
+ summary.rejected
+ )
+ })
}
pub fn logs<S: Into<String>>(self, host: S) -> Vec<FragmentLog> {
