implemented editAnchor

This commit is contained in:
2021-09-22 20:32:34 -04:00
parent 06b768ce15
commit 994e2777c3
2 changed files with 34 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ spec = do
editHostSpec
dropParamSpec
editParamSpec
editAnchorSpec
incParamBySpec
incStrBySpec
@@ -151,6 +152,25 @@ editParamSpec = describe "editParam" $ mapM_
, ( "c", Nothing )
]
editAnchorSpec :: Spec
editAnchorSpec = describe "editAnchor" $ mapM_
( \(desc, f, url, expected) -> context desc $
it ("should be " ++ show url) $
editAnchor f url `shouldBe` expected
)
-- description, function, url, expected
[ ( "reverse", Just . reverse, fooUrl, Just reversedUrl )
, ( "fail", const Nothing, fooUrl, Nothing )
, ( "reverse empty", Just . reverse, simpleUrl, Just simpleUrl )
, ( "fail empty", const Nothing, simpleUrl, Just simpleUrl )
]
where
fooUrl = urlWith "foo"
reversedUrl = urlWith "oof"
urlWith a = simpleUrl { anchor = Just a }
incParamBySpec :: Spec
incParamBySpec = describe "incParamBy" $ mapM_
( \(desc, n, pName, expected) -> context desc $