Skip to content

Commit ae19513

Browse files
committed
[#336] [stbx-protocol] test that firing fails if wiring is not valid
1 parent 58af279 commit ae19513

File tree

1 file changed

+22
-2
lines changed
  • stbx-protocol/test/Statebox/Protocol

1 file changed

+22
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
module Test.Statebox.Protocol.Fire where
22

33
import Prelude
4+
import Data.Either (Either(..))
5+
import Data.Maybe (Maybe(..))
6+
import Data.NonEmpty (NonEmpty(..))
47
import Test.Spec (Spec, describe, it)
58
import Test.Spec.Assertions (shouldEqual)
69

10+
import Statebox.Core.Wiring (NetsAndDiagramsIndex(..))
11+
import Statebox.Protocol.Fire (FiringError(..), fire)
12+
713
suite :: Spec Unit
814
suite = do
915
describe "Firing a firing" do
10-
it "should work" do
11-
1 `shouldEqual` 1
16+
it "fails if the wiring is not valid" do
17+
-- the only relevant thing here is that the wiring is not valid
18+
let wiring = { diagrams: [{ name: "diagram"
19+
, names: []
20+
, pixels: [1, 2]
21+
, width: 1
22+
}]
23+
, nets : []
24+
, labels : [NetsAndDiagramsIndex 5]
25+
}
26+
firing = { execution : Nothing
27+
, message: Nothing
28+
, path: NonEmpty 3 []
29+
}
30+
marking = mempty
31+
fire wiring firing marking `shouldEqual` Left FireInvalidWiringTree

0 commit comments

Comments
 (0)