koel/tests/Feature/OverviewTest.php

29 lines
852 B
PHP
Raw Normal View History

2022-07-26 21:00:42 +00:00
<?php
2023-06-05 21:46:41 +00:00
namespace Tests\Feature;
2022-07-26 21:00:42 +00:00
use App\Models\Interaction;
2024-01-09 18:34:40 +00:00
use Tests\TestCase;
2022-07-26 21:00:42 +00:00
2024-01-11 12:41:33 +00:00
use function Tests\create_user;
2022-07-26 21:00:42 +00:00
class OverviewTest extends TestCase
{
public function testIndex(): void
{
2024-01-11 12:41:33 +00:00
$user = create_user();
2022-07-26 21:00:42 +00:00
2022-07-27 08:49:33 +00:00
Interaction::factory(20)->for($user)->create();
2022-07-26 21:00:42 +00:00
2022-07-27 08:49:33 +00:00
$this->getAs('api/overview', $user)
2022-07-26 21:00:42 +00:00
->assertJsonStructure([
'most_played_songs' => ['*' => SongTest::JSON_STRUCTURE],
'recently_played_songs' => ['*' => SongTest::JSON_STRUCTURE],
'recently_added_albums' => ['*' => AlbumTest::JSON_STRUCTURE],
'recently_added_songs' => ['*' => SongTest::JSON_STRUCTURE],
'most_played_artists' => ['*' => ArtistTest::JSON_STRUCTURE],
'most_played_albums' => ['*' => AlbumTest::JSON_STRUCTURE],
]);
}
}