-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy patha2p.spec.ts
37 lines (34 loc) · 1.02 KB
/
a2p.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import path from "path";
import dotenv from "dotenv-override-true";
import DebugExtension from "@rc-ex/debug";
import { describe, expect, test } from "vitest";
import ReusableRestClient from "./reusable-rest-client";
dotenv.config({ path: path.join(__dirname, ".env.a2p") });
describe("SMS", () => {
test("send", async () => {
if (process.env.IS_A2P_ENV !== "true") {
return;
}
const rc = await ReusableRestClient.getInstance();
const debugExtension = new DebugExtension();
rc.installExtension(debugExtension);
debugExtension.disable();
const messageBatchResponse = await rc
.restapi()
.account()
.a2pSms()
.batches()
.post({
from: process.env.RINGCENTRAL_FROM!,
text: "hello world",
messages: [
{
to: [process.env.RINGCENTRAL_TO!],
text: "hello world 2", // override 'hello world'
},
],
});
expect(messageBatchResponse).not.toBeUndefined();
await debugExtension.revoke();
});
});