test sets endpoint
This commit is contained in:
parent
5d0a3feb2c
commit
a74bb853d4
1 changed files with 40 additions and 0 deletions
40
backend/tests/Feature/SetsEndpointTest.php
Normal file
40
backend/tests/Feature/SetsEndpointTest.php
Normal 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(),
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue