Skip to content

Commit eb8e5b9

Browse files
committed
Use test case from official Svix repo
1 parent 4353969 commit eb8e5b9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

index.test.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -1012,20 +1012,21 @@ describe("Replicate client", () => {
10121012
});
10131013

10141014
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
10171016
const request = new Request("http://test.host/webhook", {
10181017
method: "POST",
10191018
headers: {
10201019
"Content-Type": "application/json",
1021-
"Webhook-ID": "123",
1022-
"Webhook-Timestamp": "1707329251",
1020+
"Webhook-ID": "msg_p5jXN8AQM9LWM0D4loKWxJek",
1021+
"Webhook-Timestamp": "1614265330",
10231022
"Webhook-Signature":
1024-
"v1,nSIlB+PQG9cA4fNl6ec/aOmwxZktHIR5L0ymA5/Cm3E=",
1023+
"v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE=",
10251024
},
1026-
body: `{event:"output",data:"Hello, world!"}`,
1025+
body: `{"test": 2432232314}`,
10271026
});
10281027

1028+
const secret = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw";
1029+
10291030
const isValid = await validateWebhook(request, secret);
10301031
expect(isValid).toBe(true);
10311032
});

0 commit comments

Comments
 (0)