Lint Activity EditTest

This commit is contained in:
philipp lang 2024-09-21 23:43:51 +02:00
parent 3a4c99f154
commit b8d389bdb9
1 changed files with 30 additions and 35 deletions

View File

@ -5,43 +5,38 @@ namespace Tests\Feature\Activity;
use App\Activity; use App\Activity;
use App\Subactivity; use App\Subactivity;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
class EditTest extends TestCase uses(DatabaseTransactions::class);
{
use DatabaseTransactions;
public function testItEditsAnActivity(): void it('testItEditsAnActivity', function () {
{ $this->login()->loginNami()->withoutExceptionHandling();
$this->login()->loginNami()->withoutExceptionHandling(); $activity = Activity::factory()->name('Asas')->hasAttached(Subactivity::factory()->name('Pupu')->filterable())->create();
$activity = Activity::factory()->name('Asas')->hasAttached(Subactivity::factory()->name('Pupu')->filterable())->create();
$response = $this->get(route('activity.edit', ['activity' => $activity])); $response = $this->get(route('activity.edit', ['activity' => $activity]));
$this->assertInertiaHas([ $this->assertInertiaHas([
'name' => 'Asas', 'name' => 'Asas',
'is_filterable' => false,
'subactivities' => [$activity->subactivities->first()->id],
'subactivity_model' => [
'activities' => [$activity->id],
'is_age_group' => false,
'is_filterable' => false, 'is_filterable' => false,
'subactivities' => [$activity->subactivities->first()->id], 'name' => '',
'subactivity_model' => [ ],
'activities' => [$activity->id], ], $response, 'data');
'is_age_group' => false, $this->assertInertiaHas([
'is_filterable' => false, 'id' => $activity->subactivities->first()->id,
'name' => '', 'name' => 'Pupu',
], 'is_filterable' => true,
], $response, 'data'); ], $response, 'meta.subactivities.0');
$this->assertInertiaHas([ $this->assertInertiaHas([
'id' => $activity->subactivities->first()->id, 'id' => $activity->subactivities->first()->id,
'name' => 'Pupu', 'name' => 'Pupu',
'is_filterable' => true, 'is_filterable' => true,
], $response, 'meta.subactivities.0'); 'links' => [
$this->assertInertiaHas([ 'show' => route('api.subactivity.show', ['subactivity' => $activity->subactivities->first()->id]),
'id' => $activity->subactivities->first()->id, 'update' => route('api.subactivity.update', ['subactivity' => $activity->subactivities->first()->id]),
'name' => 'Pupu', ],
'is_filterable' => true, ], $response, 'meta.subactivities.0');
'links' => [ });
'show' => route('api.subactivity.show', ['subactivity' => $activity->subactivities->first()->id]),
'update' => route('api.subactivity.update', ['subactivity' => $activity->subactivities->first()->id]),
],
], $response, 'meta.subactivities.0');
}
}