chore: format json output

This commit is contained in:
appflowy 2022-08-10 10:35:00 +08:00
parent b695ceb832
commit ba3e8cc14b
2 changed files with 6 additions and 1 deletions

View File

@ -33,7 +33,7 @@ impl<'de> serde::Deserialize<'de> for TrashTypeRevision {
type Value = TrashTypeRevision;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("u8")
formatter.write_str("expected enum TrashTypeRevision with type: u8")
}
fn visit_i8<E>(self, v: i8) -> Result<Self::Value, E>

View File

@ -457,6 +457,7 @@ mod tests {
AppRevision, FolderRevision, TrashRevision, ViewRevision, WorkspaceRevision,
};
use lib_ot::core::{OperationTransform, TextDelta, TextDeltaBuilder};
use serde_json::json;
#[test]
fn folder_add_workspace() {
@ -847,6 +848,10 @@ mod tests {
let json1 = old.to_json().unwrap();
let json2 = new.to_json().unwrap();
// format the json str
let folder_rev: FolderRevision = serde_json::from_str(expected).unwrap();
let expected = serde_json::to_string(&folder_rev).unwrap();
assert_eq!(json1, expected);
assert_eq!(json1, json2);
}