This commit is contained in:
Romulus21
2024-04-01 20:29:47 +02:00
parent c0810f047b
commit 6be48846b0

View File

@@ -11,11 +11,10 @@ beforeEach(function () {
test('an user can add todo', function () {
Sanctum::actingAs($this->user);
$response = $this->post('api/todos', [
$this->post('api/todos', [
'name' => 'Test',
]);
$response->assertStatus(201)
])
->assertStatus(201)
->assertJson([
'user_id' => $this->user->id,
'name' => 'Test',
@@ -77,9 +76,8 @@ test('an user can retrieve a to do', function () {
$toDo = $toDos[rand(0, 9)];
$response = $this->get('api/todos/'.$toDo->id);
$response->assertOk()
$this->get('api/todos/'.$toDo->id)
->assertOk()
->assertJson([
'id' => $toDo->id,
'user_id' => $toDo->user_id,
@@ -128,9 +126,8 @@ test('an user can delete a to do', function () {
$toDo = $toDos[rand(0, 9)];
$response = $this->delete('api/todos/'.$toDo->id);
$response->assertNoContent();
$this->delete('api/todos/'.$toDo->id)
->assertNoContent();
expect(ToDo::all())->toHaveCount(9);
});