ApiResult serializing test unit type used
-use crate::types::api::{APIError, APIResult, SuccessResponse, True};
+use crate::types::api::{APIError, APIResult};
#[test]
fn serialize_api_result_err() {
- let error = APIResult::<String>::Err {
+ let error = APIResult::<()>::Err {
error: APIError {
message: "message".to_owned(),
code: 1,
@@ -15,10 +15,8 @@ fn serialize_api_result_err() {
#[test]
fn serialize_api_result_ok() {
- let ok = APIResult::<SuccessResponse>::Ok {
- result: SuccessResponse { success: True {} },
- };
- let ok_json = r#"{"result":{"success":true}}"#;
+ let ok = APIResult::<()>::Ok { result: () };
+ let ok_json = r#"{"result":null}"#;
let ok_serialize = serde_json::to_string(&ok).unwrap();
assert_eq!(ok_json, ok_serialize, "Ok serialized successfully");
}
