@@ -376,6 +376,57 @@ function requireSetupCheck(checks: unknown[] | undefined, id: string): Record<st
376376 return check ;
377377}
378378
379+ type TwilioSetupCredentials = {
380+ accountSid : string ;
381+ authToken : string ;
382+ fromNumber : string ;
383+ } ;
384+
385+ async function getTwilioVoiceCallCredentialsCheck ( params : {
386+ env : TwilioSetupCredentials ;
387+ configured ?: Partial < TwilioSetupCredentials > ;
388+ } ) : Promise < Record < string , unknown > > {
389+ vi . stubEnv ( "TWILIO_ACCOUNT_SID" , params . env . accountSid ) ;
390+ vi . stubEnv ( "TWILIO_AUTH_TOKEN" , params . env . authToken ) ;
391+ vi . stubEnv ( "TWILIO_FROM_NUMBER" , params . env . fromNumber ) ;
392+ const { tools } = setup (
393+ {
394+ defaultTransport : "chrome-node" ,
395+ chromeNode : { node : "parallels-macos" } ,
396+ } ,
397+ {
398+ fullConfig : {
399+ plugins : {
400+ allow : [ "google-meet" , "voice-call" ] ,
401+ entries : {
402+ "voice-call" : {
403+ enabled : true ,
404+ config : {
405+ provider : "twilio" ,
406+ publicUrl : "https://voice.example.com/voice/webhook" ,
407+ fromNumber : params . configured ?. fromNumber ,
408+ twilio : {
409+ accountSid : params . configured ?. accountSid ,
410+ authToken : params . configured ?. authToken ,
411+ } ,
412+ } ,
413+ } ,
414+ } ,
415+ } ,
416+ } ,
417+ } ,
418+ ) ;
419+ const tool = tools [ 0 ] as {
420+ execute : (
421+ id : string ,
422+ params : unknown ,
423+ ) => Promise < { details : { checks ?: unknown [ ] } } > ;
424+ } ;
425+
426+ const result = await tool . execute ( "id" , { action : "setup_status" } ) ;
427+ return requireSetupCheck ( result . details . checks , "twilio-voice-call-credentials" ) ;
428+ }
429+
379430function requireFetchGuardCall ( auditContext : string ) : Record < string , unknown > {
380431 const call = (
381432 fetchGuardMocks . fetchWithSsrFGuard . mock . calls as Array < [ Record < string , unknown > ] >
@@ -2604,6 +2655,64 @@ describe("google-meet plugin", () => {
26042655 expect ( requireSetupCheck ( result . details . checks , "twilio-voice-call-webhook" ) . ok ) . toBe ( true ) ;
26052656 } ) ;
26062657
2658+ it . each ( [
2659+ {
2660+ label : "environment account SID" ,
2661+ env : { accountSid : " " , authToken : "test-auth-token" , fromNumber : "+15550001234" } ,
2662+ } ,
2663+ {
2664+ label : "environment auth token" ,
2665+ env : { accountSid : "AC123" , authToken : " " , fromNumber : "+15550001234" } ,
2666+ } ,
2667+ {
2668+ label : "environment from number" ,
2669+ env : { accountSid : "AC123" , authToken : "test-auth-token" , fromNumber : " " } ,
2670+ } ,
2671+ {
2672+ label : "configured account SID" ,
2673+ env : { accountSid : "" , authToken : "" , fromNumber : "" } ,
2674+ configured : { accountSid : " " , authToken : "test-auth-token" , fromNumber : "+15550001234" } ,
2675+ } ,
2676+ {
2677+ label : "configured auth token" ,
2678+ env : { accountSid : "" , authToken : "" , fromNumber : "" } ,
2679+ configured : { accountSid : "AC123" , authToken : " " , fromNumber : "+15550001234" } ,
2680+ } ,
2681+ {
2682+ label : "configured from number" ,
2683+ env : { accountSid : "" , authToken : "" , fromNumber : "" } ,
2684+ configured : { accountSid : "AC123" , authToken : "test-auth-token" , fromNumber : " " } ,
2685+ } ,
2686+ ] ) ( "reports a blank $label as missing" , async ( { env, configured } ) => {
2687+ const check = await getTwilioVoiceCallCredentialsCheck ( { env, configured } ) ;
2688+
2689+ expect ( check . ok ) . toBe ( false ) ;
2690+ } ) ;
2691+
2692+ it . each ( [
2693+ {
2694+ label : "environment" ,
2695+ env : {
2696+ accountSid : " AC123 " ,
2697+ authToken : " test-auth-token " ,
2698+ fromNumber : " +15550001234 " ,
2699+ } ,
2700+ } ,
2701+ {
2702+ label : "configuration" ,
2703+ env : { accountSid : "" , authToken : "" , fromNumber : "" } ,
2704+ configured : {
2705+ accountSid : " AC123 " ,
2706+ authToken : " test-auth-token " ,
2707+ fromNumber : " +15550001234 " ,
2708+ } ,
2709+ } ,
2710+ ] ) ( "accepts padded Twilio credentials from $label" , async ( { env, configured } ) => {
2711+ const check = await getTwilioVoiceCallCredentialsCheck ( { env, configured } ) ;
2712+
2713+ expect ( check . ok ) . toBe ( true ) ;
2714+ } ) ;
2715+
26072716 it ( "reports missing voice-call wiring for explicit Twilio transport" , async ( ) => {
26082717 vi . stubEnv ( "TWILIO_ACCOUNT_SID" , "" ) ;
26092718 vi . stubEnv ( "TWILIO_AUTH_TOKEN" , "" ) ;
0 commit comments