t3-code-android-nightly/.repos/effect-smol/packages/effect/test/http/FindMyWay/querystring.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

38 lines
995 B
TypeScript

import { assert, it } from "@effect/vitest"
import { FindMyWay as Router } from "effect/http"
it("should sanitize the url - query", () => {
const router = Router.make<boolean>()
router.on("GET", "/test", true)
assert.deepStrictEqual(
router.find("GET", "/test?hello=world")?.searchParams,
{ hello: "world" }
)
})
it("should sanitize the url - hash", () => {
const router = Router.make<boolean>()
router.on("GET", "/test", true)
assert.deepStrictEqual(router.find("GET", "/test#hello")?.searchParams, {
hello: ""
})
})
it("handles path and query separated by ;", () => {
const router = Router.make<boolean>()
router.on("GET", "/test", true)
assert.deepStrictEqual(
router.find("GET", "/test;jsessionid=123456")?.searchParams,
{ jsessionid: "123456" }
)
})
it("handles %", () => {
const router = Router.make<boolean>()
router.on("GET", "/test", true)
assert.deepStrictEqual(router.find("GET", "/test?%")?.searchParams, {
"%": ""
})
})