feat(test|api): add PlayCount tests

This commit is contained in:
Phan An 2022-07-26 23:05:43 +02:00
parent f9d0956c63
commit b3ee1ff528
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC

View file

@ -0,0 +1,30 @@
<?php
namespace Tests\Feature\V6;
use App\Models\Interaction;
class PlayCountTest extends TestCase
{
public function testStore(): void
{
/** @var Interaction $interaction */
$interaction = Interaction::factory()->create([
'play_count' => 10,
]);
$response = $this->postAsUser('/api/interaction/play', [
'song' => $interaction->song->id,
], $interaction->user);
$response->assertJsonStructure([
'type',
'id',
'song_id',
'liked',
'play_count',
]);
self::assertEquals(11, $interaction->refresh()->play_count);
}
}