AppFlowy/shared-lib/flowy-grid-data-model/tests/serde_test.rs

26 lines
590 B
Rust
Raw Normal View History

2022-03-04 10:11:12 +00:00
use flowy_grid_data_model::entities::*;
#[test]
fn grid_default_serde_test() {
let grid_id = "1".to_owned();
2022-03-10 04:01:31 +00:00
let grid = GridMeta {
grid_id,
fields: vec![],
blocks: vec![],
2022-03-04 10:11:12 +00:00
};
let json = serde_json::to_string(&grid).unwrap();
assert_eq!(json, r#"{"grid_id":"1","fields":[],"blocks":[]}"#)
2022-03-04 10:11:12 +00:00
}
2022-03-15 03:07:18 +00:00
fn create_field(field_id: &str) -> FieldMeta {
let mut field = FieldMeta::new("Text Field", "", FieldType::RichText);
2022-03-12 01:30:13 +00:00
field.id = field_id.to_string();
field
2022-03-04 10:11:12 +00:00
}
2022-03-06 01:03:02 +00:00
#[allow(dead_code)]
2022-03-04 10:11:12 +00:00
fn uuid() -> String {
uuid::Uuid::new_v4().to_string()
}