Skip to content

Commit

Permalink
test: Simple test added for coverage generation and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
IronSinew committed Mar 15, 2024
1 parent 03761ac commit 2a4c289
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/Feature/Http/Controllers/SearchSimpleControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Http\Controllers;

use App\Models\Recipe;
use Database\Seeders\BasicSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia as Assert;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
* @see \App\Http\Controllers\RecipeController
*/
final class SearchSimpleControllerTest extends TestCase
{
use RefreshDatabase;

#[Test]
public function search_gives_results(): void
{
Recipe::factory()->create([
"name" => "Mac and Cheese",
]);

Recipe::factory()->create([
"name" => "Fruit Salad",
]);

$response = $this->postJson(route('search.simple'), ["search" => "Mac"]);

$response->assertOk();

$response->assertJsonPath("0.name", "Mac and Cheese");
$this->assertGreaterThan(0, Recipe::count());
}
}

0 comments on commit 2a4c289

Please sign in to comment.