implemented Handlers.incAnchorBy
This commit is contained in:
@@ -39,6 +39,7 @@ spec = do
|
||||
editParamSpec
|
||||
editAnchorSpec
|
||||
incParamBySpec
|
||||
incAnchorBySpec
|
||||
incStrBySpec
|
||||
|
||||
textToUrlSpec :: Spec
|
||||
@@ -194,6 +195,22 @@ incParamBySpec = describe "incParamBy" $ mapM_
|
||||
, ( "c", Just "foo" )
|
||||
]
|
||||
|
||||
incAnchorBySpec :: Spec
|
||||
incAnchorBySpec = describe "incAnchorBy" $ mapM_
|
||||
( \(desc, n, url, expected) -> context desc $
|
||||
it ("should be " ++ show expected) $
|
||||
incAnchorBy n url `shouldBe` expected
|
||||
)
|
||||
|
||||
-- description, number, url, expected
|
||||
[ ( "+1", 1, urlWith "1", Just $ urlWith "2" )
|
||||
, ( "+2", 2, urlWith "1", Just $ urlWith "3" )
|
||||
, ( "empty", 1, simpleUrl, Just simpleUrl )
|
||||
, ( "non-numeric", 1, urlWith "foo", Nothing )
|
||||
]
|
||||
|
||||
where urlWith str = simpleUrl { anchor = Just str }
|
||||
|
||||
incStrBySpec :: Spec
|
||||
incStrBySpec = describe "incStrBy" $ mapM_
|
||||
( \(n, str, expected) ->
|
||||
|
||||
Reference in New Issue
Block a user