Skip to content

Commit 1c84c75

Browse files
committed
add test case for createAudienceForUploadingUserIds
1 parent 93c1473 commit 1c84c75

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/libs-manageAudience.spec.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import {manageAudience} from "../lib";
2+
import * as nock from "nock";
3+
import {deepEqual, equal} from "assert";
4+
5+
const pkg = require("../package.json");
6+
7+
const channelAccessToken = "test_channel_access_token";
8+
9+
const client = new manageAudience.ManageAudienceClient({
10+
channelAccessToken,
11+
});
12+
13+
const blobClient = new manageAudience.ManageAudienceBlobClient({
14+
channelAccessToken,
15+
});
16+
17+
describe("manageAudience", () => {
18+
before(() => nock.disableNetConnect());
19+
afterEach(() => nock.cleanAll());
20+
after(() => nock.enableNetConnect());
21+
22+
it("createAudienceForUploadingUserIds", async () => {
23+
const scope = nock("https://api-data.line.me/", {
24+
reqheaders: {
25+
Authorization: "Bearer test_channel_access_token",
26+
"User-Agent": `${pkg.name}/${pkg.version}`,
27+
"content-type": /^multipart\/form-data; boundary=.*$/,
28+
},
29+
})
30+
.post("/v2/bot/audienceGroup/upload/byFile", /.*boundary.*/)
31+
.reply(200, {});
32+
33+
const res = await blobClient.createAudienceForUploadingUserIds(
34+
new Blob(["c9161b19-57f8-46c2-a71f-dfa87314dabe"], {type: "text/plain"}),
35+
"test_description",
36+
true,
37+
);
38+
equal(scope.isDone(), true);
39+
deepEqual(res, {});
40+
});
41+
});

0 commit comments

Comments
 (0)