about summary refs log tree commit diff
path: root/users/grfn/xanthous/test/Xanthous/Game
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/xanthous/test/Xanthous/Game')
-rw-r--r--users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs b/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
index 3267d8ef9e..b02abb04b4 100644
--- a/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
+++ b/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
@@ -5,6 +5,8 @@ import           Test.Prelude
 --------------------------------------------------------------------------------
 import           Xanthous.Game.State
 import           Xanthous.Entities.Raws (raws, entityFromRaw)
+import Control.Monad.Random (evalRandT)
+import System.Random (getStdGen)
 --------------------------------------------------------------------------------
 
 main :: IO ()
@@ -13,13 +15,15 @@ main = defaultMain test
 test :: TestTree
 test = testGroup "Xanthous.Game.StateSpec"
   [ testGroup "entityTypeName"
-    [ testCase "for a creature" $
+    [ testCase "for a creature" $ do
         let gormlakRaw = raws ^?! ix "gormlak"
-            creature = entityFromRaw gormlakRaw
-        in entityTypeName creature @?= "Creature"
-    , testCase "for an item" $
+        creature <- runRand $ entityFromRaw gormlakRaw
+        entityTypeName creature @?= "Creature"
+    , testCase "for an item" $ do
         let stickRaw = raws ^?! ix "stick"
-            item = entityFromRaw stickRaw
-        in entityTypeName item @?= "Item"
+        item <- runRand $ entityFromRaw stickRaw
+        entityTypeName item @?= "Item"
     ]
   ]
+  where
+    runRand x = evalRandT x =<< getStdGen