I currently have the following test code:
testUpdate :: Test
testUpdate = testCase "update does change artist" $ do
(created, Just revised, parents) <- mbTest $ do
Just editor <- fmap entityRef <$> findEditorByName "acid2"
created <- create editor startWith
let artistId = coreMbid created
newRev <- update editor (coreRevision created) expected
editId <- openEdit
includeRevision editId newRev
apply editId
found <- findLatest artistId
parents <- revisionParents newRev
return (created, found, parents)
coreData revised @?= expected
assertBool "The old revision is a direct parent of the new revision" $
parents == [coreRevision created]
where
startWith = ...
expected = ...
This kinda works, but it's messy. I'd much rather be able to write something without having to return the various things under test, and instead have the assertions where they make sense.
I see there is the Assertable
class, but it seems like I'd probably have to end up reinventing a bunch of stuff.
liftIO
? – FeliksliftIO
. However, I'll leave the question open, maybe there are other ways :) – Caseate