Re-add search functionality

This commit is contained in:
Jonny Barnes 2023-04-11 21:16:06 +01:00
parent 92c0a517c2
commit 58c5a7d443
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
11 changed files with 297 additions and 19 deletions

View file

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Tests\Feature;
use App\Models\Note;
use Tests\TestCase;
class SearchTest extends TestCase
{
/** @test */
public function searchEndpointReturnsResults(): void
{
Note::factory(10)->create();
Note::Factory()->create(['note' => 'hello world']);
$response = $this->get('/search?q=hello');
$response->assertStatus(200);
$response->assertViewIs('search');
$response->assertViewHas('search');
$response->assertViewHas('notes');
$response->assertSee('hello world');
}
}