Update tests
This commit is contained in:
@@ -3,3 +3,5 @@ dist-newstyle
|
|||||||
.direnv
|
.direnv
|
||||||
|
|
||||||
.worktrees/
|
.worktrees/
|
||||||
|
|
||||||
|
docs/superpowers
|
||||||
|
|||||||
+2
-1
@@ -34,7 +34,8 @@ spec = describe "Bus" $ do
|
|||||||
svc = Service "light" "turn_on" Nothing [EntityId "light.bedroom_masse"]
|
svc = Service "light" "turn_on" Nothing [EntityId "light.bedroom_masse"]
|
||||||
runKatipContextT (busLogEnv bus) () (Namespace ["test"]) $
|
runKatipContextT (busLogEnv bus) () (Namespace ["test"]) $
|
||||||
channelHassEval bus (CallService req svc)
|
channelHassEval bus (CallService req svc)
|
||||||
atomically (readTChan (busOutbound bus)) `shouldReturn` svc
|
(_, svc') <- atomically $ readTChan (busOutbound bus)
|
||||||
|
svc' `shouldBe` svc
|
||||||
|
|
||||||
|
|
||||||
it "generates unique sequential call ids" $ do
|
it "generates unique sequential call ids" $ do
|
||||||
|
|||||||
+4
-4
@@ -22,11 +22,11 @@ spec = describe "runController" $ do
|
|||||||
atomically $ writeTChan (busInbound bus) (doorEvent "off") -- door closes: lights on
|
atomically $ writeTChan (busInbound bus) (doorEvent "off") -- door closes: lights on
|
||||||
atomically $ writeTChan (busInbound bus) (doorEvent "on") -- door opens: lights off
|
atomically $ writeTChan (busInbound bus) (doorEvent "on") -- door opens: lights off
|
||||||
putStrLn "After the writes"
|
putStrLn "After the writes"
|
||||||
svc1 <- boundedRead (busOutbound bus)
|
Right (_, svc1) <- boundedRead (busOutbound bus)
|
||||||
svc2 <- boundedRead (busOutbound bus)
|
Right (_, svc2) <- boundedRead (busOutbound bus)
|
||||||
putStrLn "After the reads"
|
putStrLn "After the reads"
|
||||||
svc1 `shouldBe` Right (light [EntityId "light.bedroom_masse"] True)
|
svc1 `shouldBe` light [EntityId "light.bedroom_masse"] True
|
||||||
svc2 `shouldBe` Right (light [EntityId "light.bedroom_masse"] False)
|
svc2 `shouldBe` light [EntityId "light.bedroom_masse"] False
|
||||||
atomically (isEmptyTChan (busOutbound bus)) `shouldReturn` True
|
atomically (isEmptyTChan (busOutbound bus)) `shouldReturn` True
|
||||||
where
|
where
|
||||||
boundedRead channel = race (threadDelay 10000) (atomically (readTChan channel))
|
boundedRead channel = race (threadDelay 10000) (atomically (readTChan channel))
|
||||||
|
|||||||
Reference in New Issue
Block a user