Skip to content

Commit 8467f64

Browse files
committed
fix CSRF tests
1 parent e813c54 commit 8467f64

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

test/CSRF.test.js

Lines changed: 27 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/CSRF.test.res

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ describe("csrf", () => {
44
test("generate + verify with secret", () => {
55
let secret = "test-secret"
66
let token = Bun.CSRF.generateWithSecret(secret)
7-
Bun.CSRF.verifyWithOptions(token, {secret})->Expect.toBeTrue
7+
Bun.CSRF.verifyWithOptions(token, {secret: secret})
8+
->expect
9+
->Expect.toBeTrue
810
})
911

1012
test("verify fails with wrong secret", () => {
1113
let token = Bun.CSRF.generateWithSecret("correct-secret")
12-
Bun.CSRF.verifyWithOptions(token, {secret: "wrong-secret"})->Expect.toBeFalse
14+
Bun.CSRF.verifyWithOptions(token, {secret: "wrong-secret"})
15+
->expect
16+
->Expect.toBeFalse
1317
})
1418

1519
test("generate with options (encoding + expires)", () => {
1620
let secret = "opts-secret"
1721
let token = Bun.CSRF.generateWithSecretOptions(secret, {encoding: Base64Url, expiresIn: 1000.0})
18-
Bun.CSRF.verifyWithOptions(token, {secret, encoding: Base64Url})->Expect.toBeTrue
22+
Bun.CSRF.verifyWithOptions(token, {secret, encoding: Base64Url})
23+
->expect
24+
->Expect.toBeTrue
1925
})
2026
})
21-

0 commit comments

Comments
 (0)