File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1012,20 +1012,21 @@ describe("Replicate client", () => {
1012
1012
} ) ;
1013
1013
1014
1014
test ( "Can be used to validate webhook" , async ( ) => {
1015
- const secret = "whsec_5WbX5kEWLlfzsGNjH64I8lOOqUB6e8FH" ;
1016
-
1015
+ // Test case from https://github.com/svix/svix-webhooks/blob/b41728cd98a7e7004a6407a623f43977b82fcba4/javascript/src/webhook.test.ts#L190-L200
1017
1016
const request = new Request ( "http://test.host/webhook" , {
1018
1017
method : "POST" ,
1019
1018
headers : {
1020
1019
"Content-Type" : "application/json" ,
1021
- "Webhook-ID" : "123 " ,
1022
- "Webhook-Timestamp" : "1707329251 " ,
1020
+ "Webhook-ID" : "msg_p5jXN8AQM9LWM0D4loKWxJek " ,
1021
+ "Webhook-Timestamp" : "1614265330 " ,
1023
1022
"Webhook-Signature" :
1024
- "v1,nSIlB+PQG9cA4fNl6ec/aOmwxZktHIR5L0ymA5/Cm3E =" ,
1023
+ "v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE =" ,
1025
1024
} ,
1026
- body : `{event:"output",data:"Hello, world!" }` ,
1025
+ body : `{"test": 2432232314 }` ,
1027
1026
} ) ;
1028
1027
1028
+ const secret = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw" ;
1029
+
1029
1030
const isValid = await validateWebhook ( request , secret ) ;
1030
1031
expect ( isValid ) . toBe ( true ) ;
1031
1032
} ) ;
You can’t perform that action at this time.
0 commit comments