Skip to content

Commit

Permalink
Add tests for Object contents selection from a type (#1447)
Browse files Browse the repository at this point in the history
Added some tests to confirm selecting a sub-object from a Map/Object works
  • Loading branch information
andrewdavidmackenzie authored Sep 30, 2022
1 parent 6570958 commit fc08864
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flowcore/src/model/datatype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ mod test {
(ARRAY_TYPE.into(), GENERIC_TYPE.into(), ""),
(ARRAY_TYPE.into(), format!("{}/{}", ARRAY_TYPE, ARRAY_TYPE), ""),
(ARRAY_TYPE.into(), format!("{}/{}", ARRAY_TYPE, GENERIC_TYPE), ""),

// Maps (Objects) of type with a selector
(format!("{}/{}", OBJECT_TYPE, NUMBER_TYPE), NUMBER_TYPE.into(), "/name"),
];

for (case_number, test) in valid_type_conversions.iter().enumerate() {
Expand Down Expand Up @@ -508,6 +511,10 @@ mod test {
(format!("{}/{}", ARRAY_TYPE, STRING_TYPE), NUMBER_TYPE.into(), "/0"),
(format!("{}/{}", ARRAY_TYPE, BOOLEAN_TYPE), OBJECT_TYPE.into(), "/0"),
(format!("{}/{}", ARRAY_TYPE, OBJECT_TYPE), BOOLEAN_TYPE.into(), "/0"),

// Invalid object contents
(format!("{}/{}", OBJECT_TYPE, NUMBER_TYPE), STRING_TYPE.into(), "/name"),
(format!("{}/{}", OBJECT_TYPE, STRING_TYPE), STRING_TYPE.into(), ""),
];

for test in invalid_type_conversions.iter() {
Expand Down

0 comments on commit fc08864

Please sign in to comment.