@@ -116,7 +116,8 @@ class TryEventTests: _TestCase
116
116
117
117
// Fix for transitioning of routes w/ multiple from-states
118
118
// https://github.com/ReactKit/SwiftState/pull/32
119
- func testTryEvent_issue32( ) {
119
+ func testTryEvent_issue32( )
120
+ {
120
121
let machine = Machine < MyState , MyEvent > ( state: . State0) { machine in
121
122
machine. addRouteEvent ( . Event0, transitions: [ . State0 => . State1 ] )
122
123
machine. addRouteEvent ( . Event1, routes: [ [ . State1, . State2 ] => . State3 ] )
@@ -131,6 +132,31 @@ class TryEventTests: _TestCase
131
132
XCTAssertEqual ( machine. state, MyState . State3)
132
133
}
133
134
135
+ // MARK: hasRoute + event
136
+
137
+ func testHasRoute_anyEvent( )
138
+ {
139
+ ( {
140
+ let machine = Machine < MyState , MyEvent > ( state: . State0) { machine in
141
+ machine. addRoute ( . State0 => . State1)
142
+ machine. addRouteEvent ( . Any, transitions: [ . State0 => . State1] )
143
+ }
144
+
145
+ let hasRoute = machine. hasRoute ( . State0 => . State1, forEvent: . Event0)
146
+ XCTAssertTrue ( hasRoute)
147
+ } ) ( )
148
+
149
+ ( {
150
+ let machine = Machine < MyState , MyEvent > ( state: . State0) { machine in
151
+ machine. addRoute ( . State0 => . State1)
152
+ machine. addRouteEvent ( . Any, transitions: [ . State2 => . State3] )
153
+ }
154
+
155
+ let hasRoute = machine. hasRoute ( . State0 => . State1, forEvent: . Event0)
156
+ XCTAssertFalse ( hasRoute)
157
+ } ) ( )
158
+ }
159
+
134
160
// Fix hasRoute() bug when there are routes for no-event & with-event.
135
161
// https://github.com/ReactKit/SwiftState/pull/19
136
162
func testHasRoute_issue19( )
0 commit comments