File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 11import twilio from "twilio" ;
22
3- const { TWILIO_ACCOUNT_SID , TWILIO_AUTH_TOKEN } = process . env ;
3+ let TWILIO_ACCOUNT_SID
4+ let TWILIO_AUTH_TOKEN
45
5- if ( ! TWILIO_ACCOUNT_SID || ! TWILIO_AUTH_TOKEN )
6+ if ( process . env . NODE_ENV === "test" ) {
7+ TWILIO_ACCOUNT_SID = "ACabc"
8+ TWILIO_AUTH_TOKEN = "123"
9+ } else {
10+ TWILIO_ACCOUNT_SID = process . env . TWILIO_ACCOUNT_SID
11+ TWILIO_AUTH_TOKEN = process . env . TWILIO_AUTH_TOKEN
12+ }
13+
14+
15+ if ( ! TWILIO_ACCOUNT_SID || ! TWILIO_AUTH_TOKEN ) {
616 throw Error (
717 "TWILIO_ACCOUNT_SID &/or TWILIO_AUTH_TOKEN are missing from environment variables."
818 ) ;
19+ }
920
1021const client = twilio (
11- process . env . TWILIO_ACCOUNT_SID ,
12- process . env . TWILIO_AUTH_TOKEN
22+ TWILIO_ACCOUNT_SID ,
23+ TWILIO_AUTH_TOKEN
1324) ;
1425
1526export default client ;
Original file line number Diff line number Diff line change 1- import dotenv from 'dotenv'
2- dotenv . config ( )
3-
41import { ConversationInstance } from 'twilio/lib/rest/conversations/v1/conversation'
52import { CreateConversation } from "../../src/utils/createConversation.util"
63
You can’t perform that action at this time.
0 commit comments