-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e080f9
commit 13f6260
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
jest.setTimeout(15000); | ||
|
||
import twilio from "twilio"; | ||
|
||
const clientId = process.env.TWILIO_CLIENT_ID; | ||
const clientSecret = process.env.TWILIO_CLIENT_SECRET; | ||
const accountSid = process.env.TWILIO_ACCOUNT_SID; | ||
|
||
const clientCredentialProvider = new twilio.ClientCredentialProviderBuilder() | ||
.setClientId(clientId) | ||
.setClientSecret(clientSecret) | ||
.build(); | ||
|
||
const client = twilio(); | ||
client.setCredentialProvider(clientCredentialProvider); | ||
client.setAccountSid(accountSid); | ||
|
||
test("Should fetch message", () => { | ||
const messageId = process.env.TWILIO_MESSAGE_SID; | ||
return client | ||
.messages(messageId) | ||
.fetch() | ||
.then((message) => { | ||
expect(message).not.toBeNull(); | ||
expect(message).not.toBeUndefined(); | ||
expect(message.sid).toEqual(messageId); | ||
}); | ||
}); |