From 1276b467b63bc270081ec752ee66bcbd457d0355 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Mon, 7 Aug 2023 16:24:19 +0200 Subject: [PATCH] failing test --- .../TokenRouterTests.fs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs b/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs index 2a1839c..f6e91ce 100644 --- a/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs +++ b/tests/Giraffe.TokenRouter.Tests/TokenRouterTests.fs @@ -500,6 +500,32 @@ let ``GET "/foo/blah blah/bar" returns "blah blah"`` () = | Some ctx -> Assert.Equal(expected, getBody ctx) } + +[] +let ``GET "/foo/tgz/test" returns "tgz"`` () = + let ctx = Substitute.For() + let app = + router notFound [ + GET [ + route "/" => text "Hello World" + route "/foo" => text "bar" + routef "/foo/%s/%s/" (fun (operator, test) -> text (operator+" "+test)) + ] + ] + + ctx.Request.Method.ReturnsForAnyArgs "GET" |> ignore + ctx.Request.Path.ReturnsForAnyArgs (PathString("/foo/tgz/test/")) |> ignore + ctx.Response.Body <- new MemoryStream() + let expected = "tgz test" + + task { + let! result = app next ctx + + match result with + | None -> assertFailf "Result was expected to be %s" expected + | Some ctx -> Assert.Equal(expected, getBody ctx) + } + [] let ``GET "/foo/johndoe/59" returns "Name: johndoe, Age: 59"`` () = let ctx = Substitute.For()