mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add tests
This commit is contained in:
@ -83,14 +83,7 @@ impl FolderEditor {
|
||||
let FolderChangeset { operations: delta, md5 } = change;
|
||||
let (base_rev_id, rev_id) = self.rev_manager.next_rev_id_pair();
|
||||
let delta_data = delta.json_bytes();
|
||||
let revision = Revision::new(
|
||||
&self.rev_manager.object_id,
|
||||
base_rev_id,
|
||||
rev_id,
|
||||
delta_data,
|
||||
&self.user_id,
|
||||
md5,
|
||||
);
|
||||
let revision = Revision::new(&self.rev_manager.object_id, base_rev_id, rev_id, delta_data, md5);
|
||||
let _ = futures::executor::block_on(async { self.rev_manager.add_local_revision(&revision).await })?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ impl FolderPersistence {
|
||||
let pool = self.database.db_pool()?;
|
||||
let json = folder.to_json()?;
|
||||
let delta_data = FolderOperationsBuilder::new().insert(&json).build().json_bytes();
|
||||
let revision = Revision::initial_revision(user_id, folder_id.as_ref(), delta_data);
|
||||
let revision = Revision::initial_revision(folder_id.as_ref(), delta_data);
|
||||
let record = SyncRecord {
|
||||
revision,
|
||||
state: RevisionState::Sync,
|
||||
|
@ -9,7 +9,7 @@ use flowy_database::{
|
||||
use flowy_error::{internal_error, FlowyError, FlowyResult};
|
||||
use flowy_revision::disk::{RevisionChangeset, RevisionDiskCache, RevisionState, SyncRecord};
|
||||
use flowy_sync::{
|
||||
entities::revision::{RevType, Revision, RevisionRange},
|
||||
entities::revision::{Revision, RevisionRange},
|
||||
util::md5,
|
||||
};
|
||||
|
||||
@ -227,7 +227,6 @@ fn mk_revision_record_from_table(user_id: &str, table: RevisionTable) -> SyncRec
|
||||
table.base_rev_id,
|
||||
table.rev_id,
|
||||
Bytes::from(table.data),
|
||||
user_id,
|
||||
md5,
|
||||
);
|
||||
SyncRecord {
|
||||
@ -264,21 +263,3 @@ impl std::convert::From<i32> for RevTableType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<RevType> for RevTableType {
|
||||
fn from(ty: RevType) -> Self {
|
||||
match ty {
|
||||
RevType::DeprecatedLocal => RevTableType::Local,
|
||||
RevType::DeprecatedRemote => RevTableType::Remote,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<RevTableType> for RevType {
|
||||
fn from(ty: RevTableType) -> Self {
|
||||
match ty {
|
||||
RevTableType::Local => RevType::DeprecatedLocal,
|
||||
RevTableType::Remote => RevType::DeprecatedRemote,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user