Files
api/services/nginx/app/tests/Unit/Bird/BirdRouteWiringTest.php
T

85 lines
4.7 KiB
PHP

<?php
it('registers full Bird voice call route surface with strict validation and permissions', function (): void {
$content = file_get_contents(app_path('routes/birdVoiceCallsRoute.php'));
expect($content)->not->toBeFalse();
expect($content)->toContain('/bird/voice/calls');
expect($content)->toContain('/bird/voice/calls/log');
expect($content)->toContain('/bird/voice/calls/{id}');
expect($content)->toContain('/bird/voice/calls/{id}/answer');
expect($content)->toContain('/bird/voice/calls/{id}/ringing');
expect($content)->toContain('/bird/voice/calls/{id}/hangup');
expect($content)->toContain('/bird/voice/calls/{id}/playback');
expect($content)->toContain('/bird/voice/calls/{id}/say');
expect($content)->toContain('/bird/voice/calls/{id}/gather');
expect($content)->toContain('/bird/voice/calls/{id}/bridge');
expect($content)->toContain('/bird/voice/calls/{id}/record');
expect($content)->toContain('/bird/voice/calls/{id}/recordings');
expect($content)->toContain('/bird/voice/calls/{id}/recordings/{recordingId}');
expect($content)->toContain('/bird/voice/calls/{id}/insights');
expect($content)->toContain('/bird/voice/calls/test-outbound');
expect($content)->toContain('modules_bird_voice_calls_create');
expect($content)->toContain('modules_bird_voice_calls_list');
expect($content)->toContain('modules_bird_voice_calls_get');
expect($content)->toContain('modules_bird_voice_calls_update');
expect($content)->toContain('modules_bird_voice_calls_answer');
expect($content)->toContain('modules_bird_voice_calls_ringing');
expect($content)->toContain('modules_bird_voice_calls_hangup');
expect($content)->toContain('modules_bird_voice_calls_playback');
expect($content)->toContain('modules_bird_voice_calls_say');
expect($content)->toContain('modules_bird_voice_calls_gather');
expect($content)->toContain('modules_bird_voice_calls_bridge');
expect($content)->toContain('modules_bird_voice_calls_record');
expect($content)->toContain('modules_bird_voice_calls_recordings_create');
expect($content)->toContain('modules_bird_voice_calls_recordings_list');
expect($content)->toContain('modules_bird_voice_calls_recordings_get');
expect($content)->toContain('modules_bird_voice_calls_recordings_update');
expect($content)->toContain('modules_bird_voice_calls_insights_get');
expect($content)->toContain('modules_bird_voice_calls_log_list');
expect($content)->toContain('modules_bird_voice_calls_test_outbound');
expect($content)->toContain('birdValidateSchema');
expect($content)->toContain('birdResolveWorkspaceAndChannelIds');
expect($content)->toContain('birdResolveRouteCallId');
expect($content)->toContain('birdResolveRouteRecordingId');
expect($content)->toContain('bird_voice_create_call_payload::fromArray');
expect($content)->toContain('bird_voice_say_payload::fromArray');
expect($content)->toContain('bird_voice_calls_log_query_payload::fromArray');
});
it('registers flash hangup endpoint and keeps end alias wired as compatibility path', function (): void {
$content = file_get_contents(app_path('routes/birdVoiceFlashCallsRoute.php'));
expect($content)->not->toBeFalse();
expect($content)->toContain('/bird/voice/flash-calls');
expect($content)->toContain('/bird/voice/flash-calls/{id}');
expect($content)->toContain('/bird/voice/flash-calls/hangup');
expect($content)->toContain('/bird/voice/flash-calls/end');
expect($content)->toContain('modules_bird_voice_flash_calls_create');
expect($content)->toContain('modules_bird_voice_flash_calls_list');
expect($content)->toContain('modules_bird_voice_flash_calls_get');
expect($content)->toContain('modules_bird_voice_flash_calls_end');
expect($content)->toContain('modules_bird_voice_flash_calls_hangup');
expect($content)->toContain('modules_bird_voice_flash_calls_end_by_numbers');
expect($content)->toContain('flashHangupBody');
expect($content)->toContain('hangupFlashCall($workspaceId, $channelId, $payload)');
expect($content)->toContain('bird_flash_hangup_payload::fromArray');
expect($content)->toContain('bird_flash_create_payload::fromArray');
});
it('keeps Bird number and webhook routes intact', function (): void {
$numbers = file_get_contents(app_path('routes/birdNumbersRoute.php'));
$webhooks = file_get_contents(app_path('routes/birdVoiceWebhooksRoute.php'));
expect($numbers)->not->toBeFalse();
expect($numbers)->toContain('/bird/numbers');
expect($numbers)->toContain('/bird/numbers/{id}');
expect($webhooks)->not->toBeFalse();
expect($webhooks)->toContain('/bird/voice/calls/webhook/inbound');
});