test sets endpoint

This commit is contained in:
Yisroel Baum 2026-05-25 19:58:32 +03:00
parent 5d0a3feb2c
commit a74bb853d4
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -0,0 +1,40 @@
<?php
namespace Tests\Feature;
use App\Set\CreateSetDto;
use App\Set\SetRepository;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class SetsEndpointTest extends TestCase
{
use RefreshDatabase;
public function testReturnsAllSets(): void
{
$setRepository = app(SetRepository::class);
$baderechSet = $setRepository->create(new CreateSetDto(
name: 'Baderech HaAvodah',
));
$dailyLearningSet = $setRepository->create(new CreateSetDto(
name: 'Daily Learning',
));
$response = $this->getJson('/api/sets');
$response->assertOk();
$response->assertExactJson([
'sets' => [
[
'id' => $baderechSet->getId(),
'name' => $baderechSet->getName(),
],
[
'id' => $dailyLearningSet->getId(),
'name' => $dailyLearningSet->getName(),
],
],
]);
}
}