api result Ok serializing test added
-use crate::types::api::{APIError, APIResult};
+use crate::types::api::{APIError, APIResult, SuccessResponse, True};
#[test]
fn serialize_api_result_err() {
@@ -12,3 +12,13 @@ fn serialize_api_result_err() {
let error_serialize = serde_json::to_string(&error).unwrap();
assert_eq!(error_json, error_serialize, "Err serialized successfully");
}
+
+#[test]
+fn serialize_api_result_ok() {
+ let ok = APIResult::<SuccessResponse>::Ok {
+ result: SuccessResponse { success: True {} },
+ };
+ let ok_json = r#"{"result":{"success":true}}"#;
+ let ok_serialize = serde_json::to_string(&ok).unwrap();
+ assert_eq!(ok_json, ok_serialize, "Ok serialized successfully");
+}
