From a9f02dad8b9152e2fec59c8306e66ee450af2c3d Mon Sep 17 00:00:00 2001 From: pushrbx Date: Fri, 26 Jul 2024 14:14:13 +0100 Subject: [PATCH] added tests for top/reviews endpoint --- tests/Integration/TopControllerTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Integration/TopControllerTest.php b/tests/Integration/TopControllerTest.php index e85ca9f..f445066 100644 --- a/tests/Integration/TopControllerTest.php +++ b/tests/Integration/TopControllerTest.php @@ -14,6 +14,15 @@ class TopControllerTest extends TestCase use SyntheticMongoDbTransaction; 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() { Anime::factory(3)->state(new Sequence( @@ -290,4 +299,15 @@ class TopControllerTest extends TestCase $this->get('/v4/top/anime/999') ->seeStatusCode(404); } + + /** + * @dataProvider topReviewTypeParametersProvider + * @param $params + * @return void + */ + public function testTopReviews($params) + { + $this->getJsonResponse($params,"/v4/top/reviews"); + $this->seeStatusCode(200); + } }