tests check the data object in return #186

This commit is contained in:
Nabeel Shahzad
2018-02-10 18:17:38 -06:00
parent 04d44d9bd7
commit 3aa01aaa18
5 changed files with 36 additions and 33 deletions

View File

@@ -132,13 +132,13 @@ class FlightTest extends TestCase
$req = $this->get('/api/user', $headers);
$req->assertStatus(200);
$body = $req->json();
$body = $req->json()['data'];
$this->assertEquals(1, sizeof($body['bids']));
$this->assertEquals($flight->id, $body['bids'][0]['flight_id']);
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
$body = $req->json();
$body = $req->json()['data'];
$req->assertStatus(200);
$this->assertEquals($flight->id, $body[0]['id']);
@@ -156,15 +156,15 @@ class FlightTest extends TestCase
$req = $this->get('/api/user', $headers);
$req->assertStatus(200);
$body = $req->json();
$body = $req->json()['data'];
$this->assertEquals($user->id, $body['id']);
$this->assertEquals(0, sizeof($body['bids']));
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
$req->assertStatus(200);
$body = $req->json();
$body = $req->json()['data'];
$this->assertEquals(0, sizeof($body));
$this->assertCount(0, $body);
}
/**
@@ -217,15 +217,15 @@ class FlightTest extends TestCase
# And pull the flight details for the user/bids
$req = $this->get('/api/user', $headers);
$req->assertStatus(200);
$body = $req->json();
$body = $req->json()['data'];
$this->assertEquals($user->id, $body['id']);
$this->assertEquals(0, sizeof($body['bids']));
$this->assertCount(0, $body['bids']);
$req = $this->get('/api/users/'.$user->id.'/bids', $headers);
$req->assertStatus(200);
$body = $req->json();
$this->assertEquals(0, sizeof($body));
$body = $req->json()['data'];
$this->assertCount(0, $body);
}
}