Add test illustating that query params don't affect router grouping

This commit is contained in:
Oleg Grenrus 2017-01-19 23:07:11 +02:00
parent 22b4d1301d
commit 7ac095f19a

View file

@ -49,6 +49,8 @@ distributivitySpec =
dynamic `shouldHaveSameStructureAs` dynamicRef dynamic `shouldHaveSameStructureAs` dynamicRef
it "properly reorders permuted static paths" $ do it "properly reorders permuted static paths" $ do
permute `shouldHaveSameStructureAs` permuteRef permute `shouldHaveSameStructureAs` permuteRef
it "properly reorders permuted static paths in the presence of QueryParams" $ do
permuteQuery `shouldHaveSameStructureAs` permuteRef
it "properly reorders permuted static paths in the presence of Raw in end" $ do it "properly reorders permuted static paths in the presence of Raw in end" $ do
permuteRawEnd `shouldHaveSameStructureAs` permuteRawEndRef permuteRawEnd `shouldHaveSameStructureAs` permuteRawEndRef
it "properly reorders permuted static paths in the presence of Raw in beginning" $ do it "properly reorders permuted static paths in the presence of Raw in beginning" $ do
@ -154,6 +156,19 @@ permute = Proxy
permuteRef :: Proxy PermuteRef permuteRef :: Proxy PermuteRef
permuteRef = Proxy permuteRef = Proxy
-- Adding a "QueryParam" should not affect structure
type PermuteQuery =
QueryParam "1" Int :> "a" :> "b" :> "c" :> End
:<|> QueryParam "2" Int :> "b" :> "a" :> "c" :> End
:<|> QueryParam "3" Int :> "a" :> "c" :> "b" :> End
:<|> QueryParam "4" Int :> "c" :> "a" :> "b" :> End
:<|> QueryParam "5" Int :> "b" :> "c" :> "a" :> End
:<|> QueryParam "6" Int :> "c" :> "b" :> "a" :> End
permuteQuery :: Proxy PermuteQuery
permuteQuery = Proxy
-- Adding a 'Raw' in one of the ends should have minimal -- Adding a 'Raw' in one of the ends should have minimal
-- effect on the grouping. -- effect on the grouping.