<?php

namespace Tests\Feature;

use App\Models\Question;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class QuestionApiTest extends TestCase
{
    use RefreshDatabase;

    public function test_question_search_endpoint_returns_ok(): void
    {
        Question::factory()->create(['stem' => 'sample stem']);

        $response = $this->getJson('/api/questions/search?q=sample');

        $response->assertOk();
    }

    public function test_question_random_endpoint_returns_ok(): void
    {
        Question::factory()->count(3)->create();

        $response = $this->getJson('/api/questions/random?limit=2');

        $response->assertOk();
    }
}
