@@ -16,6 +16,29 @@ describe("client", () => {
16
16
after ( ( ) => close ( ) ) ;
17
17
18
18
const testMsg : Types . TextMessage = { type : "text" , text : "hello" } ;
19
+ const richMenu : Types . RichMenu = {
20
+ size : {
21
+ width : 2500 ,
22
+ height : 1686 ,
23
+ } ,
24
+ selected : false ,
25
+ name : "Nice richmenu" ,
26
+ chatBarText : "Tap here" ,
27
+ areas : [
28
+ {
29
+ bounds : {
30
+ x : 0 ,
31
+ y : 0 ,
32
+ width : 2500 ,
33
+ height : 1686 ,
34
+ } ,
35
+ action : {
36
+ type : "postback" ,
37
+ data : "action=buy&itemid=123" ,
38
+ } ,
39
+ } ,
40
+ ] ,
41
+ } ;
19
42
20
43
it ( "reply" , ( ) => {
21
44
return client . replyMessage ( "test_reply_token" , testMsg ) . then ( ( res : any ) => {
@@ -143,4 +166,64 @@ describe("client", () => {
143
166
equal ( res . method , "POST" ) ;
144
167
} ) ;
145
168
} ) ;
169
+
170
+ it ( "getRichMenu" , ( ) => {
171
+ return client . getRichMenu ( "test_rich_menu_id" ) . then ( ( res : any ) => {
172
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
173
+ equal ( res . path , "/richmenu/test_rich_menu_id" ) ;
174
+ equal ( res . method , "GET" ) ;
175
+ } ) ;
176
+ } ) ;
177
+
178
+ it ( "createRichMenu" , ( ) => {
179
+ return client . createRichMenu ( richMenu ) . then ( ( res : any ) => {
180
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
181
+ equal ( res . path , "/richmenu" ) ;
182
+ equal ( res . method , "POST" ) ;
183
+ } ) ;
184
+ } ) ;
185
+
186
+ it ( "deleteRichMenu" , ( ) => {
187
+ return client . deleteRichMenu ( "test_rich_menu_id" ) . then ( ( res : any ) => {
188
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
189
+ equal ( res . path , "/richmenu/test_rich_menu_id" ) ;
190
+ equal ( res . method , "DELETE" ) ;
191
+ } ) ;
192
+ } ) ;
193
+
194
+ it ( "getUserRichMenuIds" , ( ) => {
195
+ return client . getUserRichMenuIds ( "test_user_id" ) . then ( ( res : any ) => {
196
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
197
+ equal ( res . path , "/user/test_user_id/richmenu" ) ;
198
+ equal ( res . method , "GET" ) ;
199
+ } ) ;
200
+ } ) ;
201
+
202
+ it ( "linkRichMenuWithUser" , ( ) => {
203
+ return client
204
+ . linkRichMenuWithUser ( "test_user_id" , "test_rich_menu_id" )
205
+ . then ( ( res : any ) => {
206
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
207
+ equal ( res . path , "/user/test_user_id/richmenu/test_rich_menu_id" ) ;
208
+ equal ( res . method , "POST" ) ;
209
+ } ) ;
210
+ } ) ;
211
+
212
+ it ( "unlinkRichMenuWithUser" , ( ) => {
213
+ return client
214
+ . unlinkRichMenuWithUser ( "test_user_id" , "test_rich_menu_id" )
215
+ . then ( ( res : any ) => {
216
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
217
+ equal ( res . path , "/user/test_user_id/richmenu/test_rich_menu_id" ) ;
218
+ equal ( res . method , "DELETE" ) ;
219
+ } ) ;
220
+ } ) ;
221
+
222
+ it ( "getRichMenuList" , ( ) => {
223
+ return client . getRichMenuList ( ) . then ( ( res : any ) => {
224
+ equal ( res . headers . authorization , "Bearer test_channel_access_token" ) ;
225
+ equal ( res . path , "/richmenu/list" ) ;
226
+ equal ( res . method , "GET" ) ;
227
+ } ) ;
228
+ } ) ;
146
229
} ) ;
0 commit comments