about summary refs log tree commit diff
path: root/test/Xanthous/Data
diff options
context:
space:
mode:
Diffstat (limited to 'test/Xanthous/Data')
-rw-r--r--test/Xanthous/Data/EntityMapSpec.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/Xanthous/Data/EntityMapSpec.hs b/test/Xanthous/Data/EntityMapSpec.hs
index 2e9714a44eb7..53f03020f346 100644
--- a/test/Xanthous/Data/EntityMapSpec.hs
+++ b/test/Xanthous/Data/EntityMapSpec.hs
@@ -2,9 +2,11 @@
 --------------------------------------------------------------------------------
 module Xanthous.Data.EntityMapSpec where
 --------------------------------------------------------------------------------
-import Test.Prelude
+import           Test.Prelude
 --------------------------------------------------------------------------------
-import Xanthous.Data.EntityMap
+import qualified Data.Aeson as JSON
+--------------------------------------------------------------------------------
+import           Xanthous.Data.EntityMap
 --------------------------------------------------------------------------------
 
 main :: IO ()
@@ -30,4 +32,9 @@ test = localOption (QuickCheckTests 20)
         then (em₁ == em₃)
         else True
     ]
+  , testGroup "JSON encoding/decoding"
+    [ testProperty "Preserves IDs" $ \(em :: EntityMap Int) ->
+        let Just em' = JSON.decode $ JSON.encode em
+        in toEIDsAndPositioned em' === toEIDsAndPositioned em
+    ]
   ]