From fad924d28d0998cdcf203a2d783ee19f0d38c136 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Tue, 21 Dec 2021 10:02:01 -0800 Subject: [PATCH] Add another test case. --- tests/ApiRouteTests.elm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/ApiRouteTests.elm b/tests/ApiRouteTests.elm index d4e952f8..69c6dc98 100644 --- a/tests/ApiRouteTests.elm +++ b/tests/ApiRouteTests.elm @@ -135,6 +135,32 @@ all = ] Pattern.NoPendingSlash ) + , test "hybrid route with multiple static segments" <| + \() -> + succeed + (\repo -> + DataSource.succeed ("Data for repo " ++ repo |> ServerResponse.stringBody) + ) + |> ApiRoute.literal "api" + |> ApiRoute.slash + |> ApiRoute.literal "repo" + |> ApiRoute.slash + |> ApiRoute.capture + |> ApiRoute.literal ".json" + |> serverless + |> Internal.ApiRoute.toPattern + |> Expect.equal + (Pattern + [ Pattern.Literal "api" + , Pattern.Literal "repo" + , Pattern.HybridSegment + ( Pattern.Dynamic + , Pattern.Literal ".json" + , [] + ) + ] + Pattern.NoPendingSlash + ) ] , describe "multi-part" [ test "multi-level routes" <|