chore: fix tests

This commit is contained in:
appflowy 2022-07-08 08:37:12 +08:00
parent 487dd13c6c
commit 6fd36980c8

View File

@ -19,13 +19,15 @@ impl GridSelectOptionFilter {
let selected_option_ids: Vec<&String> = selected_options.options.iter().map(|option| &option.id).collect(); let selected_option_ids: Vec<&String> = selected_options.options.iter().map(|option| &option.id).collect();
match self.condition { match self.condition {
SelectOptionCondition::OptionIs => { SelectOptionCondition::OptionIs => {
// if selected options equal to filter's options, then the required_options will be empty.
let required_options = self let required_options = self
.option_ids .option_ids
.iter() .iter()
.filter(|id| selected_option_ids.contains(id)) .filter(|id| !selected_option_ids.contains(id))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
// https://stackoverflow.com/questions/69413164/how-to-fix-this-clippy-warning-needless-collect // https://stackoverflow.com/questions/69413164/how-to-fix-this-clippy-warning-needless-collect
required_options.is_empty() !required_options.is_empty()
} }
SelectOptionCondition::OptionIsNot => { SelectOptionCondition::OptionIsNot => {
for option_id in selected_option_ids { for option_id in selected_option_ids {