Skip to content

Commit c2070b5

Browse files
committed
graphql: add unit test for empty IN filter
1 parent 2e77635 commit c2070b5

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

graphql/src/store/query.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,26 @@ mod tests {
971971
)
972972
}
973973

974+
#[test]
975+
fn build_query_handles_empty_in_list() {
976+
let query_field = default_field_with(
977+
"where",
978+
r::Value::Object(Object::from_iter(vec![(
979+
"id_in".into(),
980+
r::Value::List(vec![]),
981+
)])),
982+
);
983+
984+
let result = query(&query_field);
985+
assert_eq!(
986+
result.filter,
987+
Some(EntityFilter::And(vec![EntityFilter::In(
988+
"id".to_string(),
989+
Vec::<Value>::new(),
990+
)]))
991+
);
992+
}
993+
974994
#[test]
975995
fn build_query_yields_block_change_gte_filter() {
976996
let query_field = default_field_with(

0 commit comments

Comments
 (0)