File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
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" : / ^ m u l t i p a r t \/ f o r m - d a t a ; b o u n d a r y = .* $ / ,
28
+ } ,
29
+ } )
30
+ . post ( "/v2/bot/audienceGroup/upload/byFile" , / .* b o u n d a r y .* / )
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments