Add /api/news route

This commit is contained in:
Nabeel Shahzad
2018-04-11 20:01:41 -05:00
parent 8d2fd22e3e
commit 395642f69c
5 changed files with 95 additions and 0 deletions

View File

@@ -62,6 +62,18 @@ class ApiTest extends TestCase
$this->get($uri)->assertStatus(401);
}
/**
* Test getting the news from the API
*/
public function testGetNews(): void
{
factory(App\Models\News::class)->create();
$response = $this->get('/api/news')->json();
$this->assertCount(1, $response['data']);
$this->assertTrue(array_key_exists('user', $response['data'][0]));
}
/**
*
*/