implemented Helpers.incParamBy

This commit is contained in:
2021-09-22 19:01:10 -04:00
parent 515109f45d
commit 06b768ce15
2 changed files with 36 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ spec = do
editHostSpec
dropParamSpec
editParamSpec
incParamBySpec
incStrBySpec
textToUrlSpec :: Spec
@@ -150,6 +151,29 @@ editParamSpec = describe "editParam" $ mapM_
, ( "c", Nothing )
]
incParamBySpec :: Spec
incParamBySpec = describe "incParamBy" $ mapM_
( \(desc, n, pName, expected) -> context desc $
it ("should be " ++ show expected) $
incParamBy n pName url `shouldBe` expected
)
-- description, number, param, expected
[ ( "+1", 1, "a", Just $ urlWith "3" )
, ( "+2", 2, "a", Just $ urlWith "4" )
, ( "non-numeric", 1, "c", Nothing )
, ( "missing", 1, "d", Just url )
]
where
url = urlWith "2"
urlWith n = simpleUrl { params = mkParams n }
mkParams n =
[ ( "a", Just n )
, ( "b", Just "2" )
, ( "c", Just "foo" )
]
incStrBySpec :: Spec
incStrBySpec = describe "incStrBy" $ mapM_
( \(n, str, expected) ->