File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { messagingApi } 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 messagingApi . MessagingApiClient ( {
10
+ channelAccessToken,
11
+ } ) ;
12
+
13
+ const blobClient = new messagingApi . MessagingApiBlobClient ( {
14
+ channelAccessToken,
15
+ } ) ;
16
+
17
+ describe ( "messagingApi" , ( ) => {
18
+ before ( ( ) => nock . disableNetConnect ( ) ) ;
19
+ afterEach ( ( ) => nock . cleanAll ( ) ) ;
20
+ after ( ( ) => nock . enableNetConnect ( ) ) ;
21
+
22
+ it ( "setRichMenuImage" , 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" : "image/jpeg" ,
28
+ } ,
29
+ } )
30
+ . post ( "/v2/bot/richmenu/aaaaaa/content" , "GREAT_JPEG" )
31
+ . reply ( 200 , { } ) ;
32
+
33
+ const res = await blobClient . setRichMenuImage (
34
+ "aaaaaa" ,
35
+ new Blob ( [ "GREAT_JPEG" ] , { type : "image/jpeg" } ) ,
36
+ ) ;
37
+ equal ( scope . isDone ( ) , true ) ;
38
+ deepEqual ( res , { } ) ;
39
+ } ) ;
40
+ } ) ;
You can’t perform that action at this time.
0 commit comments