Nathan.fooo 069519589e
Fix/grid group (#1787)
* ci: config rust log

* chore: rename flowy-sdk to appflowy-core

* fix: create group after editing the url

* fix: start listen on new group

* chore: add tests

* refactor: mock data

* ci: update command
2023-02-02 23:02:49 +08:00

46 lines
1.4 KiB
Rust

use crate::grid::field_test::util::create_text_field;
use crate::grid::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;
}