chore: fix unit test

This commit is contained in:
appflowy 2022-07-04 15:53:21 +08:00
parent e5f35e46ca
commit e85606ac21
2 changed files with 51 additions and 3 deletions

View File

@ -33,7 +33,35 @@ impl<'de> serde::Deserialize<'de> for TrashTypeRevision {
type Value = TrashTypeRevision;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("struct Insert")
formatter.write_str("u8")
}
fn visit_i8<E>(self, v: i8) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_i16<E>(self, v: i16) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_i32<E>(self, v: i32) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_u8<E>(self, v: u8) -> Result<Self::Value, E>
@ -50,6 +78,27 @@ impl<'de> serde::Deserialize<'de> for TrashTypeRevision {
Ok(ty)
}
fn visit_u16<E>(self, v: u16) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_u32<E>(self, v: u32) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
self.visit_u8(v as u8)
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: serde::de::Error,

View File

@ -8,7 +8,6 @@ use crate::{
},
errors::{CollaborateError, CollaborateResult},
};
use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision};
use lib_infra::util::move_vec_element;
use lib_ot::core::*;
@ -724,7 +723,7 @@ mod tests {
"name": "🚽 my first trash",
"modified_time": 0,
"create_time": 0,
"ty": "Unknown"
"ty": 0
}
]
}