Skip to content

Commit c9ee101

Browse files
committed
Use test case from official Svix repo
1 parent f8e0e57 commit c9ee101

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
@@ -996,20 +996,21 @@ describe("Replicate client", () => {
996996
});
997997

998998
test("Can be used to validate webhook", async () => {
999-
const secret = "whsec_5WbX5kEWLlfzsGNjH64I8lOOqUB6e8FH";
1000-
999+
// Test case from https://github.com/svix/svix-webhooks/blob/b41728cd98a7e7004a6407a623f43977b82fcba4/javascript/src/webhook.test.ts#L190-L200
10011000
const request = new Request("http://test.host/webhook", {
10021001
method: "POST",
10031002
headers: {
10041003
"Content-Type": "application/json",
1005-
"Webhook-ID": "123",
1006-
"Webhook-Timestamp": "1707329251",
1004+
"Webhook-ID": "msg_p5jXN8AQM9LWM0D4loKWxJek",
1005+
"Webhook-Timestamp": "1614265330",
10071006
"Webhook-Signature":
1008-
"v1,nSIlB+PQG9cA4fNl6ec/aOmwxZktHIR5L0ymA5/Cm3E=",
1007+
"v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE=",
10091008
},
1010-
body: `{event:"output",data:"Hello, world!"}`,
1009+
body: `{"test": 2432232314}`,
10111010
});
10121011

1012+
const secret = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw";
1013+
10131014
const isValid = await validateWebhook(request, secret);
10141015
expect(isValid).toBe(true);
10151016
});

0 commit comments

Comments
 (0)