mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
Redesign (#124)
- redesign the dashboard - add search bar - Mobile-friendly design
This commit is contained in:
58
tests/Feature/SearchTest.php
Normal file
58
tests/Feature/SearchTest.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SearchTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_search_server(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$this->get(route('search', ['q' => $this->server->name]))
|
||||
->assertOk()
|
||||
->assertJson([
|
||||
'results' => [
|
||||
[
|
||||
'type' => 'server',
|
||||
'url' => route('servers.show', ['server' => $this->site->server]),
|
||||
'text' => $this->server->name,
|
||||
'project' => $this->server->project->name,
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_search_site(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$this->get(route('search', ['q' => $this->site->domain]))
|
||||
->assertOk()
|
||||
->assertJson([
|
||||
'results' => [
|
||||
[
|
||||
'type' => 'site',
|
||||
'url' => route('servers.sites.show', ['server' => $this->site->server, 'site' => $this->site]),
|
||||
'text' => $this->site->domain,
|
||||
'project' => $this->site->server->project->name,
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_search_has_no_results(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$this->get(route('search', ['q' => 'nothing-will-found']))
|
||||
->assertOk()
|
||||
->assertJson([
|
||||
'results' => [],
|
||||
]);
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ public function setUp(): void
|
||||
config()->set('filesystems.disks.key-pairs.root', storage_path('app/key-pairs-test'));
|
||||
|
||||
$this->user = User::factory()->create();
|
||||
$this->user->createDefaultProject();
|
||||
|
||||
\App\Models\NotificationChannel::factory()->create([
|
||||
'provider' => NotificationChannel::EMAIL,
|
||||
@ -60,6 +61,7 @@ private function setupServer(): void
|
||||
{
|
||||
$this->server = Server::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'project_id' => $this->user->current_project_id,
|
||||
]);
|
||||
|
||||
$keys = $this->server->sshKey();
|
||||
|
Reference in New Issue
Block a user