Core UI updates for helpdesk
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Modules\Helpdesk\Tests\Feature;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Helpdesk\Livewire\KanbanBoard;
|
||||
use Modules\Helpdesk\Models\KanbanBoard as KanbanBoardModel;
|
||||
use Modules\Helpdesk\Tests\Concerns\BuildsHelpdeskFixtures;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -25,6 +26,7 @@ final class KanbanBoardTest extends TestCase
|
||||
'owner' => $user,
|
||||
'status_id' => $lookups['open']->id,
|
||||
'priority_id' => $lookups['high']->id,
|
||||
'board_id' => $lookups['board']->id,
|
||||
'subject' => 'Kanban visible ticket',
|
||||
]);
|
||||
|
||||
@@ -47,6 +49,7 @@ final class KanbanBoardTest extends TestCase
|
||||
'owner' => $user,
|
||||
'status_id' => $lookups['open']->id,
|
||||
'priority_id' => $lookups['normal']->id,
|
||||
'board_id' => $lookups['board']->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($user);
|
||||
@@ -58,6 +61,38 @@ final class KanbanBoardTest extends TestCase
|
||||
$ticket->refresh();
|
||||
|
||||
$this->assertSame($lookups['closed']->id, $ticket->status_id);
|
||||
$this->assertSame($lookups['board']->id, $ticket->board_id);
|
||||
$this->assertNotNull($ticket->completed_at);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function kanban_ticket_can_be_moved_to_another_board_and_only_has_one_board(): void
|
||||
{
|
||||
$lookups = $this->seedLookupData();
|
||||
$user = $this->admin();
|
||||
$targetBoard = KanbanBoardModel::query()->create([
|
||||
'name' => 'Development Board',
|
||||
'slug' => 'development-board',
|
||||
'is_default' => false,
|
||||
'sort_order' => 20,
|
||||
]);
|
||||
$targetBoard->statuses()->sync([$lookups['open']->id => ['sort_order' => 10]]);
|
||||
|
||||
$ticket = $this->ticket([
|
||||
'owner' => $user,
|
||||
'status_id' => $lookups['open']->id,
|
||||
'priority_id' => $lookups['normal']->id,
|
||||
'board_id' => $lookups['board']->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
Livewire::test(KanbanBoard::class)
|
||||
->call('moveTicketToBoard', $ticket->id, $targetBoard->id)
|
||||
->assertHasNoErrors();
|
||||
|
||||
$ticket->refresh();
|
||||
|
||||
$this->assertSame($targetBoard->id, $ticket->board_id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user