test(api): cover the team update audit event

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-09-28 14:06:14 +02:00
co-authored by Claude Opus 5.5
parent 7c21c330c9
commit 81af5892d7
@@ -1,5 +1,6 @@
<?php
use App\Models\AuditEvent;
use App\Models\InstanceSettings;
use App\Models\Team;
use App\Models\User;
@@ -71,6 +72,18 @@ describe('token team endpoints', function () {
expect($this->team->fresh()->is_build_server_fallback_enabled)->toBeFalse();
});
test('PATCH /team records an audit event', function () {
$this->withHeaders(teamTokenApiHeaders($this->bearerToken))
->patchJson('/api/v1/team', [
'is_build_server_fallback_enabled' => false,
])
->assertOk();
$event = AuditEvent::query()->where('event', 'api.team.updated')->sole();
expect($event->team_id)->toBe($this->team->id)
->and(data_get($event->metadata, 'changed_fields'))->toBe(['is_build_server_fallback_enabled']);
});
test('PATCH /team validates the build server fallback policy', function () {
$this->withHeaders(teamTokenApiHeaders($this->bearerToken))
->patchJson('/api/v1/team', [