fix: fix mocking for workflows

This commit is contained in:
Ruben Fiszel
2023-10-18 21:44:10 +02:00
parent f03a2e7062
commit fbfa08cb5a
2 changed files with 10 additions and 9 deletions
+1 -2
View File
@@ -12,7 +12,6 @@ use std::{
};
use serde::{self, Deserialize, Serialize, Serializer};
use serde_json::value::RawValue;
use crate::{
more_serde::{
@@ -176,7 +175,7 @@ pub struct Suspend {
pub struct Mock {
pub enabled: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub return_value: Option<Box<RawValue>>,
pub return_value: Option<serde_json::Value>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
+9 -7
View File
@@ -1448,13 +1448,15 @@ async fn push_next_flow_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>
let mut hm = HashMap::new();
hm.insert(
"previous_result".to_string(),
module
.mock
.as_ref()
.unwrap()
.return_value
.clone()
.unwrap_or_else(|| serde_json::from_str("null").unwrap()),
to_raw_value(
&module
.mock
.as_ref()
.unwrap()
.return_value
.clone()
.unwrap_or_else(|| serde_json::from_str("null").unwrap()),
),
);
Ok(hm)
} else if let Some(id) = get_args_from_id {