about summary refs log blame commit diff
path: root/users/grfn/xanthous/test/Xanthous/Entities/RawsSpec.hs
blob: b6c80be51be7a4748b7ec1f6703e371ef094c1bb (plain) (tree)
1
2
3
4
5
6
7
8





                                                    

                                                                              







                                                       











                                                                            

     
-- |

module Xanthous.Entities.RawsSpec (main, test) where

import Test.Prelude
import Xanthous.Entities.Raws
import Xanthous.Entities.RawTypes
       (_Creature, entityName, generateParams, HasEquippedItem (equippedItem))

main :: IO ()
main = defaultMain test

test :: TestTree
test = testGroup "Xanthous.Entities.Raws"
  [ testGroup "raws"
    [ testCase "are all valid" $ raws `deepseq` pure ()
    , testCase "all CreatureEquippedItems reference existent entity names" $
      let notFound
            = raws
              ^.. folded
              . _Creature
              . generateParams
              . _Just
              . equippedItem
              . _Just
              . entityName
              . filtered (isNothing . raw)
      in null notFound @? ("Some entities weren't found: " <> show notFound)
    ]
  ]