Skip to content

Commit

Permalink
Add idempotency test
Browse files Browse the repository at this point in the history
  • Loading branch information
cblp committed Aug 8, 2018
1 parent db4fe0f commit bfdb048
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ff-test/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,17 @@ test_CvRDT_Note :: [TestTree]
test_CvRDT_Note = cvrdtLaws @Note

case_json2ron :: IO ()
case_json2ron =
case runStorageSim fs123 upgradeDatabase of
Left e -> fail e
Right ((), db') -> db' @?= fs123merged
case_json2ron = do

-- read JSON, merge, write RON
do ((), db') <- either fail pure $ runStorageSim fs123 upgradeDatabase
db' @?= fs123merged

-- idempotency
do ((), db') <-
either fail pure $ runStorageSim fs123merged upgradeDatabase
db' @?= fs123merged

where
fs123merged = Map.singleton "note" $ Map.singleton "1" $
Map.singleton "a6bp8-6qen" $ norm [i|
Expand Down

0 comments on commit bfdb048

Please sign in to comment.