File: InventoryMUnitTests.hs

package info (click to toggle)
haskell-lambdahack 0.11.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,064 kB
  • sloc: haskell: 45,636; makefile: 223
file content (49 lines) | stat: -rw-r--r-- 1,867 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
-- TODO: at some point we'll want our unit test hierarchy to match the
-- main codebase file hierarchy
module InventoryMUnitTests (inventoryMUnitTests) where

import Prelude ()

import Game.LambdaHack.Core.Prelude

import Test.Tasty
import Test.Tasty.HUnit

import Game.LambdaHack.Client.UI.InventoryM
import Game.LambdaHack.Definition.Defs

import UnitTestHelpers

inventoryMUnitTests :: TestTree
inventoryMUnitTests = testGroup "inventoryMUnitTests"
  [ testCase "getFull no stores " $ do
      let testFn = getFull testActorId
                           (return SuitsEverything)  -- :: m Suitability
                           (\_ _ _ _ _ -> "specific prompt")
                           (\_ _ _ _ _ -> "generic prompt")
                           []  -- :: [CStore]
                           False
                           False
      result <- executorCli testFn stubCliState
      fst result @?= Left "no items"
  , testCase "getFull no item in eqp store" $ do
      let testFn = getFull testActorId
                           (return SuitsEverything)
                           (\_ _ _ _ _ -> "specific prompt")
                           (\_ _ _ _ _ -> "generic prompt")
                           [CEqp]
                           False
                           False
      result <- executorCli testFn stubCliState
      fst result @?= Left "no items in equipment outfit"
  , testCase "getFull an item in eqp store" $ do
      let testFn = getFull testActorId
                           (return SuitsEverything)
                           (\_ _ _ _ _ -> "specific prompt")
                           (\_ _ _ _ _ -> "generic prompt")
                           [CEqp]
                           False
                           False
      result <- executorCli testFn testCliStateWithItem
      fst result @?= Right (CEqp, [(testItemId, (1, []))])
  ]