Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: fix tests
appflowy5ea3213c4e12
diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_tests.rsindex 9e041cc415..1a60a0a5a8 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs@@ -25,6 +25,6 @@ mod tests {assert_eq!(decode_any_cell_data(data, &field_rev,).to_string(), NO);let data = apply_cell_data_changeset("12", None, &field_rev).unwrap();- assert_eq!(decode_any_cell_data(data, &field_rev,).to_string(), NO);+ assert_eq!(decode_any_cell_data(data, &field_rev,).to_string(), "");}}diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rsindex 54cde9b310..233c481eb6 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rs@@ -6,7 +6,7 @@ use std::str::FromStr;pub const YES: &str = "Yes";pub const NO: &str = "No";-pub struct CheckboxCellData(pub String);+pub struct CheckboxCellData(String);impl CheckboxCellData {pub fn is_check(&self) -> bool {diff --git a/frontend/rust-lib/flowy-grid/src/services/filter/impls/checkbox_filter.rs b/frontend/rust-lib/flowy-grid/src/services/filter/impls/checkbox_filter.rsindex ca67d7aeaf..24e21bbeb7 100644--- a/frontend/rust-lib/flowy-grid/src/services/filter/impls/checkbox_filter.rs+++ b/frontend/rust-lib/flowy-grid/src/services/filter/impls/checkbox_filter.rs@@ -28,6 +28,7 @@ impl CellFilterOperation<GridCheckboxFilter> for CheckboxTypeOption {mod tests {use crate::entities::{CheckboxCondition, GridCheckboxFilter};use crate::services::field::CheckboxCellData;+ use std::str::FromStr;#[test]fn checkbox_filter_is_check_test() {@@ -35,7 +36,7 @@ mod tests {condition: CheckboxCondition::IsChecked,};for (value, visible) in [("true", true), ("yes", true), ("false", false), ("no", false)] {- let data = CheckboxCellData(value.to_owned());+ let data = CheckboxCellData::from_str(value).unwrap();assert_eq!(checkbox_filter.is_visible(&data), visible);}}@@ -46,7 +47,7 @@ mod tests {condition: CheckboxCondition::IsUnChecked,};for (value, visible) in [("false", true), ("no", true), ("true", false), ("yes", false)] {- let data = CheckboxCellData(value.to_owned());+ let data = CheckboxCellData::from_str(value).unwrap();assert_eq!(checkbox_filter.is_visible(&data), visible);}}diff --git a/frontend/rust-lib/flowy-grid/tests/grid/block_test/row_test.rs b/frontend/rust-lib/flowy-grid/tests/grid/block_test/row_test.rsindex 6dafb2973f..7b64a44b48 100644--- a/frontend/rust-lib/flowy-grid/tests/grid/block_test/row_test.rs+++ b/frontend/rust-lib/flowy-grid/tests/grid/block_test/row_test.rs@@ -9,13 +9,13 @@ use flowy_grid_data_model::revision::RowMetaChangeset;async fn grid_create_row_count_test() {let mut test = GridRowTest::new().await;let scripts = vec![- AssertRowCount(3),+ AssertRowCount(5),CreateEmptyRow,CreateEmptyRow,CreateRow {row_rev: test.row_builder().build(),},- AssertRowCount(6),+ AssertRowCount(8),];test.run_scripts(scripts).await;}@@ -31,11 +31,11 @@ async fn grid_update_row() {cell_by_field_id: Default::default(),};- let scripts = vec![AssertRowCount(3), CreateRow { row_rev }, UpdateRow { changeset }];+ let scripts = vec![AssertRowCount(5), CreateRow { row_rev }, UpdateRow { changeset }];test.run_scripts(scripts).await;let expected_row = test.last_row().unwrap();- let scripts = vec![AssertRow { expected_row }, AssertRowCount(4)];+ let scripts = vec![AssertRow { expected_row }, AssertRowCount(6)];test.run_scripts(scripts).await;}@@ -46,19 +46,19 @@ async fn grid_delete_row() {let row_2 = test.row_builder().build();let row_ids = vec![row_1.id.clone(), row_2.id.clone()];let scripts = vec![- AssertRowCount(3),+ AssertRowCount(5),CreateRow { row_rev: row_1 },CreateRow { row_rev: row_2 },AssertBlockCount(1),AssertBlock {block_index: 0,- row_count: 5,+ row_count: 7,start_row_index: 0,},DeleteRows { row_ids },AssertBlock {block_index: 0,- row_count: 3,+ row_count: 5,start_row_index: 0,},];