diff --git a/tests/Search/CombTest.php b/tests/Search/CombTest.php index 13a73d620b..897dea3fe2 100644 --- a/tests/Search/CombTest.php +++ b/tests/Search/CombTest.php @@ -255,6 +255,20 @@ public function it_can_search_for_umlauts() #[Test] public function it_filters_out_results_with_disallowed_words() + { + $comb = new Comb([ + ['title' => 'Pizza', 'ingredients' => 'Tomato, Cheese, Bread'], + ['title' => 'Tomato Soup', 'ingredients' => 'Tomato, Water, Salt'], + ['title' => 'Chicken & Sweetcorn Soup', 'ingredients' => 'Chicken, Sweetcorn, Water'], + ]); + + $results = $comb->lookUp('soup -tomato'); + + $this->assertEquals(['Chicken & Sweetcorn Soup'], collect($results['data'] ?? [])->pluck('data.title')->all()); + } + + #[Test] + public function it_filters_out_results_with_disallowed_words_where_results_are_arrays() { $comb = new Comb([ ['title' => 'Pizza', 'ingredients' => ['Tomato', 'Cheese', 'Bread']],