mirror of
https://github.com/koel/koel
synced 2025-02-17 13:58:28 +00:00
feat(test|api): add PlayCount tests
This commit is contained in:
parent
f9d0956c63
commit
b3ee1ff528
1 changed files with 30 additions and 0 deletions
30
tests/Feature/V6/PlayCountTest.php
Normal file
30
tests/Feature/V6/PlayCountTest.php
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue