Spaces:
Sleeping
Sleeping
File size: 899 Bytes
6773345 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php
namespace Tests\Feature;
use Tests\TestCase;
class CalendlyWebhookTest extends TestCase
{
public function test_calendly_webhook_requires_configured_secret(): void
{
config(['app.calendly_webhook_secret' => null]);
$response = $this->postJson('/api/v1/calendly/webhooks', ['event' => 'invitee.created']);
$response->assertStatus(503)
->assertJsonPath('error.code', 'CALENDLY_WEBHOOK_SECRET_REQUIRED');
}
public function test_calendly_webhook_rejects_invalid_signature(): void
{
config(['app.calendly_webhook_secret' => 'test-secret']);
$response = $this->withHeader('Calendly-Webhook-Signature', 'v1=invalid')
->postJson('/api/v1/calendly/webhooks', ['event' => 'invitee.created']);
$response->assertStatus(401)
->assertJsonPath('error.code', 'INVALID_CALENDLY_SIGNATURE');
}
}
|