Create endpoint to load bid by ID (#1248)

* Create endpoint to load bid by ID

* Fix endpoint
This commit is contained in:
Nabeel S
2021-06-17 19:42:56 -04:00
committed by GitHub
parent b6a2fe405d
commit 35359b8646
5 changed files with 55 additions and 6 deletions

View File

@@ -185,6 +185,8 @@ class BidTest extends TestCase
{
$this->user = factory(User::class)->create();
$user2 = factory(User::class)->create();
/** @var \App\Models\Flight $flight */
$flight = $this->addFlight($this->user);
$uri = '/api/user/bids';
@@ -194,6 +196,14 @@ class BidTest extends TestCase
$body = $body->json('data');
$this->assertEquals($body['flight_id'], $flight->id);
$this->assertNotEmpty($body['flight']);
$res = $this->get('/api/bids/'.$body['id']);
$res->assertOk();
$body = $res->json('data');
$this->assertEquals($body['flight_id'], $flight->id);
$this->assertNotEmpty($body['flight']);
// Now try to have the second user bid on it
// Should return a 409 error