@@ -15,23 +15,10 @@ const getRecentReq = (): { body: Types.WebhookRequestBody } =>
15
15
JSON . parse ( readFileSync ( join ( __dirname , "helpers/request.json" ) ) . toString ( ) ) ;
16
16
17
17
describe ( "middleware" , ( ) => {
18
- const http = (
19
- headers : any = {
20
- "X-Line-Signature" : "jhKDdIeWwHj2SW6BIeHlUyePWOlfCcoGlyA1oFajRlQ=" ,
21
- } ,
22
- ) =>
23
- new HTTPClient ( {
24
- baseURL : `http://localhost:${ TEST_PORT } ` ,
25
- defaultHeaders : headers ,
26
- } ) ;
27
-
28
- before ( ( ) => listen ( TEST_PORT , m ) ) ;
29
- after ( ( ) => close ( ) ) ;
30
-
31
18
const webhook : Types . MessageEvent = {
32
19
message : {
33
20
id : "test_event_message_id" ,
34
- text : "this is test message." ,
21
+ text : "this is test message.ππ
π’πππ
π’π " ,
35
22
type : "text" ,
36
23
} ,
37
24
replyToken : "test_reply_token" ,
@@ -43,6 +30,18 @@ describe("middleware", () => {
43
30
mode : "active" ,
44
31
type : "message" ,
45
32
} ;
33
+ const webhookSignature = {
34
+ "X-Line-Signature" : "GzU7H3qOXDzDD6cNcS/9otLzlLFxnYYriz62rNu5BDE=" ,
35
+ } ;
36
+
37
+ const http = ( headers : any = { ...webhookSignature } ) =>
38
+ new HTTPClient ( {
39
+ baseURL : `http://localhost:${ TEST_PORT } ` ,
40
+ defaultHeaders : headers ,
41
+ } ) ;
42
+
43
+ before ( ( ) => listen ( TEST_PORT , m ) ) ;
44
+ after ( ( ) => close ( ) ) ;
46
45
47
46
it ( "succeed" , async ( ) => {
48
47
await http ( ) . post ( `/webhook` , {
0 commit comments