Skip to content

Commit

Permalink
chore: add cluster test for oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Dec 9, 2024
1 parent 4e080f9 commit 13f6260
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/cluster/public_oauth.spec.ts
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);
});
});

0 comments on commit 13f6260

Please sign in to comment.