Add another test case.

This commit is contained in:
Dillon Kearns 2021-12-21 10:02:01 -08:00
parent 0d3b918048
commit fad924d28d

View File

@ -135,6 +135,32 @@ all =
] ]
Pattern.NoPendingSlash 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" , describe "multi-part"
[ test "multi-level routes" <| [ test "multi-level routes" <|