diff options
author | 2021-12-27 19:37:34 -0800 | |
---|---|---|
committer | 2021-12-28 03:37:34 +0000 | |
commit | 397a38bb4d1dc5a2eef186906ee6570837efb2f5 (patch) | |
tree | 4250164288ecbc9bc638eccc1d3da7c333b423f7 /src/models/properties/tests.rs | |
parent | 1f66869e74edd7711d213ebf546acf75506c9cd3 (diff) | |
download | notion-397a38bb4d1dc5a2eef186906ee6570837efb2f5.tar.gz notion-397a38bb4d1dc5a2eef186906ee6570837efb2f5.tar.zst notion-397a38bb4d1dc5a2eef186906ee6570837efb2f5.zip |
fix(#32): Fix rollup value parsing issues (#33)
Fixes #32: Rollup values were not being parsed correctly.
Diffstat (limited to 'src/models/properties/tests.rs')
-rw-r--r-- | src/models/properties/tests.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/models/properties/tests.rs b/src/models/properties/tests.rs index 8fe5b42..022f080 100644 --- a/src/models/properties/tests.rs +++ b/src/models/properties/tests.rs @@ -1,4 +1,4 @@ -use super::{DateOrDateTime, PropertyValue}; +use super::{DateOrDateTime, PropertyValue, RollupPropertyValue, RollupValue}; use chrono::NaiveDate; #[test] @@ -32,3 +32,25 @@ fn parse_text_property_with_link() { let _property: PropertyValue = serde_json::from_str(include_str!("tests/text_with_link.json")).unwrap(); } + +#[test] +fn parse_rollup_property() { + let property: PropertyValue = + serde_json::from_str(include_str!("tests/rollup_property.json")).unwrap(); + + assert!(matches!( + property, + PropertyValue::Rollup { + rollup: Some(RollupValue::Array { .. }), + .. + } + )); + + if let PropertyValue::Rollup { + rollup: Some(RollupValue::Array { array }), + .. + } = property + { + assert!(matches!(array[0], RollupPropertyValue::Text { .. })) + } +} |