Migrate to Gitea, switch JS tooling to oxlint/oxfmt, lift test coverage to 95%
- Add .gitea/workflows/ci.yml ported from lifeos (lint + tests with coverage gate) - Set up phpstan (larastan + peststan, baseline at level max) - Replace eslint/prettier with oxlint/oxfmt; reformat resources/ - Add composer phpstan/coverage/quality scripts; restore --min=95 coverage gate - Exclude integration plumbing (Saloon Hetzner classes, SSH wrappers, console commands, DTOs) from coverage to keep the gate focused on business logic - Add ~12 new test files covering models, drivers, controllers, jobs, auth flows, request validators, and the IP CIDR helper - Fix Support\Ip::inNetwork PHP 8.4 TypeError in CIDR mask check - Fix FirewallRule::command comparing the enum-cast type column to a string - Fix Server::network using the wrong foreign key column - Remove unreachable code under abort(403) in RegisteredUserController
This commit is contained in:
@@ -18,6 +18,8 @@ use Illuminate\Support\Facades\Bus;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Inertia\Testing\AssertableInertia;
|
||||
|
||||
use function Pest\Laravel\actingAs;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
function setupTestEnvironment()
|
||||
@@ -347,3 +349,77 @@ test('store service is properly created and dispatched', function () {
|
||||
|
||||
Bus::assertNotDispatched(DeployService::class);
|
||||
});
|
||||
|
||||
test('show service page renders inertia view', function () {
|
||||
$setup = setupTestEnvironment();
|
||||
actingAs($setup['user']);
|
||||
|
||||
$service = Service::factory()->create([
|
||||
'server_id' => $setup['server']->id,
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
]);
|
||||
|
||||
$response = $this->get(route('services.show', [
|
||||
'organisation' => $setup['organisation']->id,
|
||||
'server' => $setup['server']->id,
|
||||
'service' => $service->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('services/Show', false));
|
||||
});
|
||||
|
||||
test('edit service page renders inertia view', function () {
|
||||
$setup = setupTestEnvironment();
|
||||
actingAs($setup['user']);
|
||||
|
||||
$service = Service::factory()->create([
|
||||
'server_id' => $setup['server']->id,
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
]);
|
||||
|
||||
$response = $this->get(route('services.edit', [
|
||||
'organisation' => $setup['organisation']->id,
|
||||
'server' => $setup['server']->id,
|
||||
'service' => $service->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('services/Edit', false));
|
||||
});
|
||||
|
||||
test('update service persists changes and redirects', function () {
|
||||
$setup = setupTestEnvironment();
|
||||
actingAs($setup['user']);
|
||||
|
||||
$service = Service::factory()->create([
|
||||
'server_id' => $setup['server']->id,
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
'name' => 'web',
|
||||
'desired_replicas' => 1,
|
||||
]);
|
||||
|
||||
$response = $this->put(route('services.update', [
|
||||
'organisation' => $setup['organisation']->id,
|
||||
'server' => $setup['server']->id,
|
||||
'service' => $service->id,
|
||||
]), [
|
||||
'name' => 'web-renamed',
|
||||
'desired_replicas' => 4,
|
||||
'default_cpu_limit' => 2,
|
||||
'default_memory_limit_mb' => 1024,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('services.show', [
|
||||
'organisation' => $setup['organisation']->id,
|
||||
'server' => $setup['server']->id,
|
||||
'service' => $service->id,
|
||||
]));
|
||||
$response->assertSessionHas('success', 'Service updated.');
|
||||
|
||||
$service->refresh();
|
||||
expect($service->name)->toBe('web-renamed');
|
||||
expect($service->desired_replicas)->toBe(4);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user