Add integrations health monitoring
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-02 18:35:12 +01:00
parent 9057a4cd15
commit fc3e6715db
21 changed files with 715 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature;
use App\Jobs\ProcessRevenueCatWebhook;
use App\Models\IntegrationWebhookEvent;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Bus;
use Tests\TestCase;
@@ -17,6 +18,7 @@ class RevenueCatWebhookTest extends TestCase
$payload = [
'event' => [
'type' => 'INITIAL_PURCHASE',
'app_user_id' => 'tenant-123',
'product_id' => 'pro_month',
],
@@ -28,12 +30,20 @@ class RevenueCatWebhookTest extends TestCase
Bus::fake();
$response = $this->postJson('/api/v1/webhooks/revenuecat', $payload, [
'X-Event-Id' => 'evt_123',
'X-Signature' => $signature,
]);
$response->assertStatus(202)
->assertJson(['status' => 'accepted']);
$this->assertDatabaseHas('integration_webhook_events', [
'provider' => 'revenuecat',
'event_id' => 'evt_123',
'event_type' => 'INITIAL_PURCHASE',
'status' => IntegrationWebhookEvent::STATUS_RECEIVED,
]);
Bus::assertDispatched(ProcessRevenueCatWebhook::class);
}
@@ -53,6 +63,8 @@ class RevenueCatWebhookTest extends TestCase
->assertJsonPath('error.code', 'signature_invalid')
->assertJsonPath('error.title', 'Invalid Signature');
$this->assertDatabaseCount('integration_webhook_events', 0);
Bus::assertNotDispatched(ProcessRevenueCatWebhook::class);
}
}