diff --git a/tests/Feature/ApiTest.php b/tests/Feature/ApiTest.php new file mode 100644 index 0000000..67dbe0f --- /dev/null +++ b/tests/Feature/ApiTest.php @@ -0,0 +1,51 @@ +getJson('/api/search/stats'); + $response->assertStatus(422); + } + + /** + * Test that the search API works with query params + * + * @return void + */ + public function testSearchApiParam(): void + { + $response = $this->getJson('/api/search/stats?searchDate=2030-04-26'); + $response->assertStatus(200); + $response->assertExactJson([ + 'commentsPoints' => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'commitsPoints' => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'pullsPoints' => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + ]); + } + + /** + * Test that the search API works with query params + * + * @return void + */ + public function testSearchApiParams(): void + { + $response = $this->getJson('/api/search/stats?searchDate=2030-04-26&searchTerm=l'); + $response->assertStatus(200); + $response->assertExactJson([ + 'commentsPoints' => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'commitsPoints' => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'pullsPoints' => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + ]); + } +} diff --git a/tests/Feature/FrontTest.php b/tests/Feature/FrontTest.php index 68ee7a5..c706dc8 100644 --- a/tests/Feature/FrontTest.php +++ b/tests/Feature/FrontTest.php @@ -7,7 +7,7 @@ final class FrontTest extends TestCase { /** - * Test the the welcome page works + * Test that the welcome page works * * @return void */ @@ -19,7 +19,7 @@ public function testWelcomePage(): void } /** - * Test the the search page works + * Test that the search page works * * @return void */ @@ -31,7 +31,7 @@ public function testSearchPage(): void } /** - * Test the the search page works with query params + * Test that the search page works with query params * * @return void */