@@ -180,6 +180,55 @@ describe("messagingApi", () => {
180180 } ) ;
181181 } ) ;
182182
183+ it ( "get coupon list" , async ( ) => {
184+ let requestCount = 0 ;
185+ server . use (
186+ http . get (
187+ "https://api.line.me/v2/bot/coupon" ,
188+ async ( { request, params, cookies } ) => {
189+ requestCount ++ ;
190+
191+ equal (
192+ request . headers . get ( "authorization" ) ,
193+ "Bearer test_channel_access_token" ,
194+ ) ;
195+ equal ( request . headers . get ( "User-Agent" ) , "@line/bot-sdk/1.0.0-test" ) ;
196+
197+ const url = new URL ( request . url ) ;
198+ const searchParams = url . searchParams ;
199+ equal ( searchParams . get ( "status" ) , "DRAFT,RUNNING,CLOSED" ) ;
200+ equal ( searchParams . get ( "start" ) , "xBQU2IB" ) ;
201+ equal ( searchParams . get ( "limit" ) , "100" ) ;
202+
203+ return HttpResponse . json ( {
204+ items : [
205+ {
206+ couponId : "coupon_id_1" ,
207+ title : "coupon 1" ,
208+ } ,
209+ ] ,
210+ next : "yANU9IA.." ,
211+ } ) ;
212+ } ,
213+ ) ,
214+ ) ;
215+
216+ const res = await client . listCoupon (
217+ new Set ( [ "DRAFT" , "RUNNING" , "CLOSED" ] ) ,
218+ "xBQU2IB" ,
219+ 100 ,
220+ ) ;
221+ deepEqual ( res , {
222+ items : [
223+ {
224+ couponId : "coupon_id_1" ,
225+ title : "coupon 1" ,
226+ } ,
227+ ] ,
228+ next : "yANU9IA.." ,
229+ } ) ;
230+ } ) ;
231+
183232 it ( "config is not overrided" , async ( ) => {
184233 const config = {
185234 channelAccessToken : "token-token" ,
0 commit comments