toDo change order
This commit is contained in:
@@ -220,6 +220,36 @@ class ToDoItemsTest extends TestCase
|
||||
->assertStatus(403);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_to_do_can_changer_of_order()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$this->actingAs($user = factory(User::class)->create(), 'api');
|
||||
$toDoList = factory(ToDoList::class)->create(['id' => 123, 'user_id' => $user->id]);
|
||||
$this->post('/api/to-do-lists/123/to-do', ['name' => 'Test name to do']);
|
||||
$toDoReplaced = $this->post('/api/to-do-lists/123/to-do', ['name' => 'Test 2 name to do']);
|
||||
$this->post('/api/to-do-lists/123/to-do', ['name' => 'Test 3 name to do']);
|
||||
$this->post('/api/to-do-lists/123/to-do', ['name' => 'Test 4 name to do']);
|
||||
$todoMove = $this->post('/api/to-do-lists/123/to-do', ['name' => 'Test 5 name to do']);
|
||||
|
||||
|
||||
$response = $this->patch('/api/to-do-lists/'. $toDoList->id .'/to-do/'. $todoMove['data']['to_do_id'] .'/change', ['new-order' => $toDoReplaced['data']['attributes']['data']['order']])
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
'data' => [
|
||||
'to_do_id' => $todoMove['data']['to_do_id'],
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'order' => $toDoReplaced['data']['attributes']['data']['order'],
|
||||
]
|
||||
]
|
||||
],
|
||||
'links' => [
|
||||
'self' => url('/to-do-lists/'. $toDoList->id),
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_to_do_list_can_be_delete()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user