From 481fd9df514334ac55fa6ec553651dc3cee7d2c4 Mon Sep 17 00:00:00 2001 From: appflowy Date: Thu, 2 Jun 2022 20:24:25 +0800 Subject: [PATCH] fix: rust unit test --- .../application/grid/cell/cell_service/context_builder.dart | 1 + .../src/services/field/type_options/date_type_option.rs | 2 +- .../src/services/field/type_options/text_type_option.rs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart index b554f03556..3041c563d9 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart @@ -219,6 +219,7 @@ class _GridCellContext extends Equatable { } void dispose() { + _cellListener.stop(); _loadDataOperation?.cancel(); _saveDataOperation?.cancel(); diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs index 891eb2f336..f91fc8bb48 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs @@ -358,7 +358,7 @@ impl std::convert::From for CellContentChangeset { mod tests { use crate::services::field::FieldBuilder; use crate::services::field::{DateCellContentChangeset, DateCellData, DateFormat, DateTypeOption, TimeFormat}; - use crate::services::row::{CellDataOperation, EncodedCellData}; + use crate::services::row::CellDataOperation; use flowy_grid_data_model::entities::{FieldMeta, FieldType, TypeOptionDataEntry}; use strum::IntoEnumIterator; diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs index 029d476533..b59681a2ea 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs @@ -80,10 +80,10 @@ mod tests { // date let field_type = FieldType::DateTime; let date_time_field_meta = FieldBuilder::from_field_type(&field_type).build(); - let json = serde_json::to_string(&DateCellDataSerde::new(1647251762, None)).unwrap(); + assert_eq!( type_option - .decode_cell_data(json, &field_type, &date_time_field_meta) + .decode_cell_data(1647251762.to_string(), &field_type, &date_time_field_meta) .unwrap() .parse::() .unwrap()