added tests for top/reviews endpoint

This commit is contained in:
pushrbx 2024-07-26 14:14:13 +01:00
parent 6e4ff113e3
commit a9f02dad8b
No known key found for this signature in database
GPG Key ID: A16A474BBC2C91D9

View File

@ -14,6 +14,15 @@ class TopControllerTest extends TestCase
use SyntheticMongoDbTransaction; use SyntheticMongoDbTransaction;
use ScoutFlush; use ScoutFlush;
public function topReviewTypeParametersProvider(): array
{
return [
"empty query string" => [[]],
"query string = `?type=anime`" => [["type" => "anime"]],
"query string = `?type=manga`" => [["type" => "manga"]],
];
}
public function testTopAnime() public function testTopAnime()
{ {
Anime::factory(3)->state(new Sequence( Anime::factory(3)->state(new Sequence(
@ -290,4 +299,15 @@ class TopControllerTest extends TestCase
$this->get('/v4/top/anime/999') $this->get('/v4/top/anime/999')
->seeStatusCode(404); ->seeStatusCode(404);
} }
/**
* @dataProvider topReviewTypeParametersProvider
* @param $params
* @return void
*/
public function testTopReviews($params)
{
$this->getJsonResponse($params,"/v4/top/reviews");
$this->seeStatusCode(200);
}
} }