瀏覽代碼

fix: rust unit test

appflowy 2 年之前
父節點
當前提交
481fd9df51

+ 1 - 0
frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart

@@ -219,6 +219,7 @@ class _GridCellContext<T, D> extends Equatable {
   }
 
   void dispose() {
+    _cellListener.stop();
     _loadDataOperation?.cancel();
     _saveDataOperation?.cancel();
 

+ 1 - 1
frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs

@@ -358,7 +358,7 @@ impl std::convert::From<DateCellContentChangeset> 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;
 

+ 2 - 2
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::<DateCellData>()
                 .unwrap()