mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 09:01:21 +00:00

* refactor: rename structs * chore: read database id from view * chore: fix open database error because of create a database view for database id * chore: fix tests * chore: rename datbase id to view id in flutter * refactor: move grid and board to database view folder * refactor: rename functions * refactor: move calender to datbase view folder * refactor: rename app_flowy to appflowy_flutter * chore: reanming * chore: fix freeze gen * chore: remove todos * refactor: view process events * chore: add link database test * chore: just open view if there is opened database
48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
use crate::database::field_test::util::create_text_field;
|
|
use crate::database::snapshot_test::script::{DatabaseSnapshotTest, SnapshotScript::*};
|
|
|
|
#[tokio::test]
|
|
async fn snapshot_create_test() {
|
|
let mut test = DatabaseSnapshotTest::new().await;
|
|
let (_, field_rev) = create_text_field(&test.grid_id());
|
|
let scripts = vec![CreateField { field_rev }, WriteSnapshot];
|
|
test.run_scripts(scripts).await;
|
|
|
|
let snapshot = test.current_snapshot.clone().unwrap();
|
|
let content = test.grid_pad().await.json_str().unwrap();
|
|
test
|
|
.run_scripts(vec![AssertSnapshotContent {
|
|
snapshot,
|
|
expected: content,
|
|
}])
|
|
.await;
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn snapshot_multi_version_test() {
|
|
let mut test = DatabaseSnapshotTest::new().await;
|
|
let original_content = test.grid_pad().await.json_str().unwrap();
|
|
|
|
// Create a field
|
|
let (_, field_rev) = create_text_field(&test.grid_id());
|
|
let scripts = vec![
|
|
CreateField {
|
|
field_rev: field_rev.clone(),
|
|
},
|
|
WriteSnapshot,
|
|
];
|
|
test.run_scripts(scripts).await;
|
|
|
|
// Delete a field
|
|
let scripts = vec![DeleteField { field_rev }, WriteSnapshot];
|
|
test.run_scripts(scripts).await;
|
|
|
|
// The latest snapshot will be the same as the original content.
|
|
test
|
|
.run_scripts(vec![AssertSnapshotContent {
|
|
snapshot: test.get_latest_snapshot().await.unwrap(),
|
|
expected: original_content,
|
|
}])
|
|
.await;
|
|
}
|