mirror of
https://github.com/koel/koel
synced 2025-02-17 13:58:28 +00:00
feat(test|api): add ExcerptSearch tests
This commit is contained in:
parent
705e135f1c
commit
e86cdf5131
3 changed files with 31 additions and 2 deletions
|
@ -6,7 +6,7 @@ use App\Models\Album;
|
|||
|
||||
class AlbumTest extends TestCase
|
||||
{
|
||||
private const JSON_STRUCTURE = [
|
||||
public const JSON_STRUCTURE = [
|
||||
'type',
|
||||
'id',
|
||||
'name',
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Models\Artist;
|
|||
|
||||
class ArtistTest extends TestCase
|
||||
{
|
||||
private const JSON_STRUCTURE = [
|
||||
public const JSON_STRUCTURE = [
|
||||
'type',
|
||||
'id',
|
||||
'name',
|
||||
|
|
29
tests/Feature/V6/ExcerptSearchTest.php
Normal file
29
tests/Feature/V6/ExcerptSearchTest.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\V6;
|
||||
|
||||
use App\Models\Album;
|
||||
use App\Models\Artist;
|
||||
use App\Models\Song;
|
||||
|
||||
class ExcerptSearchTest extends TestCase
|
||||
{
|
||||
public function testSearch(): void
|
||||
{
|
||||
Song::factory()->create(['title' => 'A Foo Song']);
|
||||
Song::factory(6)->create();
|
||||
|
||||
Artist::factory()->create(['name' => 'Foo Fighters']);
|
||||
Artist::factory(3)->create();
|
||||
|
||||
Album::factory()->create(['name' => 'Foo Number Five']);
|
||||
Album::factory(4)->create();
|
||||
|
||||
$this->getAsUser('api/search?q=foo')
|
||||
->assertJsonStructure([
|
||||
'songs' => ['*' => SongTest::JSON_STRUCTURE],
|
||||
'artists' => ['*' => ArtistTest::JSON_STRUCTURE],
|
||||
'albums' => ['*' => AlbumTest::JSON_STRUCTURE],
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue