todo front in work

This commit is contained in:
2020-04-27 11:06:12 +02:00
parent e1d9c02c5e
commit 94d6e6a4dc
9 changed files with 132 additions and 12 deletions

View File

@@ -88,6 +88,50 @@ class ToDoListsTest extends TestCase
$response->assertStatus(403);
}
/** @test */
public function a_user_can_retrueved_all_this_to_do_lists()
{
$this->actingAs($user = factory(User::class)->create(), 'api');
$toDoListOne = factory(ToDoList::class)->create(['user_id' => $user->id]);
$toDoListTwo = factory(ToDoList::class)->create(['user_id' => $user->id]);
$response = $this->get('/api/to-do-lists');
$response->assertJson([
'data' => [
[
'data' => [
'to_do_list_id' => $toDoListOne->id,
'attributes' => [
'data' => [
'name' => $toDoListOne->name,
'last_updated' => $toDoListOne->updated_at->diffForHumans(),
]
],
],
'links' => [
'self' => $toDoListOne->path(),
]
],
[
'data' => [
'to_do_list_id' => $toDoListTwo->id,
'attributes' => [
'data' => [
'name' => $toDoListTwo->name,
'last_updated' => $toDoListTwo->updated_at->diffForHumans(),
]
],
],
'links' => [
'self' => $toDoListTwo->path(),
]
]
]
]);
}
/** @test */
public function a_to_do_list_can_be_patch()
{