1pub mod shared {
2 pub mod helper;
3
4 include!("generated/shared.rs");
5
6 #[cfg(test)]
7 pub mod tests {
8 use crate::shared::Flow;
9 use serde_json;
10
11 #[test]
12 fn test_serialize() {
13 let flow = Flow {
14 flow_id: 0,
15 project_id: 0,
16 data_types: vec![],
17 input_type_identifier: None,
18 return_type_identifier: None,
19 r#type: "no".to_string(),
20 settings: vec![],
21 starting_node: None,
22 };
23
24 let str_flow = serde_json::to_string(&flow).expect("Serialization failed");
25 let json_flow: serde_json::Value =
26 serde_json::from_str(&str_flow).expect("Failed to parse JSON");
27
28 let expected_json: serde_json::Value = serde_json::json!({
29 "flow_id": 0,
30 "project_id": 0,
31 "type": "no",
32 "input_type_identifier": null,
33 "return_type_identifier": null,
34 "data_types": [],
35 "settings": [],
36 "starting_node": null
37 });
38
39 assert_eq!(json_flow, expected_json);
40 }
41
42 #[test]
43 fn test_deserialize() {
44 let json_data = r#"{
45 "flow_id": 0,
46 "project_id": 0,
47 "type": "no",
48 "input_type_identifier": null,
49 "return_type_identifier": null,
50 "data_types": [],
51 "settings": [],
52 "starting_node": null
53 }"#;
54
55 let deserialized: Result<Flow, _> = serde_json::from_str(json_data);
56 assert!(deserialized.is_ok());
57
58 let expected_flow = Flow {
59 flow_id: 0,
60 project_id: 0,
61 r#type: "no".to_string(),
62 settings: vec![],
63 data_types: vec![],
64 input_type_identifier: None,
65 return_type_identifier: None,
66 starting_node: None,
67 };
68
69 assert_eq!(deserialized.unwrap(), expected_flow);
70 }
71 }
72}
73
74#[cfg(feature = "aquila")]
75pub mod aquila {
76 include!("generated/aquila.rs");
77}
78
79#[cfg(feature = "sagittarius")]
80pub mod sagittarius {
81 include!("generated/sagittarius.rs");
82}