Skip to content

Commit

Permalink
Add test for non-arrays which worked before this pr
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Jan 22, 2025
1 parent 7079447 commit 6f43378
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Search/CombTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']],
Expand Down

0 comments on commit 6f43378

Please sign in to comment.