@@ -8,16 +8,16 @@ describe('Statemachine', () => {
88 test ( 'should set initial state' , ( ) => {
99
1010 type States = {
11- state : 'FOO'
11+ current : 'FOO'
1212 } | {
13- state : 'BAR'
13+ current : 'BAR'
1414 }
1515
1616 const state = statemachine < States > ( {
1717 FOO : [ 'BAR' ] ,
1818 BAR : [ 'FOO' ]
1919 } , {
20- state : 'FOO' ,
20+ current : 'FOO' ,
2121 } )
2222
2323 const config = {
@@ -26,21 +26,21 @@ describe('Statemachine', () => {
2626
2727 const overmind = createOvermindMock ( config )
2828
29- expect ( overmind . state . state ) . toBe ( 'FOO' )
29+ expect ( overmind . state . current ) . toBe ( 'FOO' )
3030 } )
3131
3232 test ( 'should transition state' , ( ) => {
3333 type States = {
34- state : 'FOO'
34+ current : 'FOO'
3535 } | {
36- state : 'BAR'
36+ current : 'BAR'
3737 }
3838
3939 const state = statemachine < States > ( {
4040 FOO : [ 'BAR' ] ,
4141 BAR : [ 'FOO' ]
4242 } , {
43- state : 'FOO' ,
43+ current : 'FOO' ,
4444 } )
4545 const transition : Action = ( { state } ) => {
4646 state . transition ( 'BAR' , { } )
@@ -59,22 +59,22 @@ describe('Statemachine', () => {
5959
6060
6161 overmind . actions . transition ( )
62- expect ( overmind . state . state ) . toBe ( 'BAR' )
62+ expect ( overmind . state . current ) . toBe ( 'BAR' )
6363 } )
6464
6565 test ( 'should ignore transition to invalid state' , ( ) => {
6666
6767 type States = {
68- state : 'FOO'
68+ current : 'FOO'
6969 } | {
70- state : 'BAR'
70+ current : 'BAR'
7171 }
7272
7373 const state = statemachine < States > ( {
7474 FOO : [ ] ,
7575 BAR : [ 'FOO' ]
7676 } , {
77- state : 'FOO'
77+ current : 'FOO'
7878 } )
7979 const transition : Action = ( { state } ) => {
8080 state . transition ( 'BAR' , { } )
@@ -91,29 +91,29 @@ describe('Statemachine', () => {
9191
9292 const overmind = createOvermindMock ( config )
9393 overmind . actions . transition ( )
94- expect ( overmind . state . state ) . toBe ( 'FOO' )
94+ expect ( overmind . state . current ) . toBe ( 'FOO' )
9595 } )
9696
9797 test ( 'should run entry and exit transition' , async ( ) => {
9898 expect . assertions ( 3 )
9999 type States = {
100- state : 'FOO'
100+ current : 'FOO'
101101 } | {
102- state : 'BAR'
102+ current : 'BAR'
103103 }
104104
105105 const state = statemachine < States > ( {
106106 FOO : [ 'BAR' ] ,
107107 BAR : [ 'FOO' ]
108108 } , {
109- state : 'FOO'
109+ current : 'FOO'
110110 } )
111111
112112 const transition : Action = async ( { state } ) => {
113113 state . transition ( 'BAR' , { } , ( barState ) => {
114- expect ( barState . state ) . toBe ( 'BAR' )
114+ expect ( barState . current ) . toBe ( 'BAR' )
115115 state . transition ( 'FOO' , { } , ( fooState ) => {
116- expect ( fooState . state ) . toBe ( 'FOO' )
116+ expect ( fooState . current ) . toBe ( 'FOO' )
117117 } )
118118 } )
119119 }
@@ -130,23 +130,23 @@ describe('Statemachine', () => {
130130 const overmind = createOvermindMock ( config )
131131
132132 await overmind . actions . transition ( )
133- expect ( overmind . state . state ) . toBe ( 'FOO' )
133+ expect ( overmind . state . current ) . toBe ( 'FOO' )
134134 } )
135135
136136 test ( 'should flush changes to transitions' , ( ) => {
137137 expect . assertions ( 1 )
138138
139139 type States = {
140- state : 'FOO'
140+ current : 'FOO'
141141 } | {
142- state : 'BAR'
142+ current : 'BAR'
143143 }
144144
145145 const state = statemachine < States > ( {
146146 FOO : [ 'BAR' ] ,
147147 BAR : [ 'FOO' ]
148148 } , {
149- state : 'FOO'
149+ current : 'FOO'
150150 } )
151151
152152 const transition : Action = ( { state } ) => {
@@ -163,7 +163,7 @@ describe('Statemachine', () => {
163163 interface Action extends IAction < typeof config , void , void > { }
164164
165165 const overmind = createOvermind ( config )
166- overmind . reaction ( ( state ) => state . state , ( value ) => {
166+ overmind . reaction ( ( state ) => state . current , ( value ) => {
167167 expect ( value ) . toBe ( 'BAR' )
168168 } )
169169 overmind . actions . transition ( )
@@ -173,16 +173,16 @@ describe('Statemachine', () => {
173173 expect . assertions ( 1 )
174174
175175 type States = {
176- state : 'FOO'
176+ current : 'FOO'
177177 } | {
178- state : 'BAR'
178+ current : 'BAR'
179179 }
180180
181181 const state = statemachine < States > ( {
182182 FOO : [ 'BAR' ] ,
183183 BAR : [ 'FOO' ]
184184 } , {
185- state : 'FOO'
185+ current : 'FOO'
186186 } )
187187 const transition : Action = async ( { state } ) => {
188188 await state . transition ( 'BAR' , { } , async ( ) => {
@@ -209,16 +209,16 @@ describe('Statemachine', () => {
209209 expect . assertions ( 3 )
210210
211211 type States = {
212- state : 'FOO'
212+ current : 'FOO'
213213 } | {
214- state : 'BAR'
214+ current : 'BAR'
215215 }
216216
217217 const state = statemachine < States > ( {
218218 FOO : [ 'BAR' ] ,
219219 BAR : [ 'FOO' ]
220220 } , {
221- state : 'FOO' ,
221+ current : 'FOO' ,
222222 } )
223223 const transition : Action = async ( { state } ) => {
224224 await state . transition ( 'BAR' , { } , async ( ) => {
@@ -252,12 +252,12 @@ describe('Statemachine', () => {
252252 test ( 'should make copy of statemachine during tests' , ( ) => {
253253
254254 type States = {
255- state : 'FOO'
255+ current : 'FOO'
256256 obj : {
257257 foo : string
258258 }
259259 } | {
260- state : 'BAR'
260+ current : 'BAR'
261261 obj : {
262262 foo : string
263263 }
@@ -267,7 +267,7 @@ describe('Statemachine', () => {
267267 FOO : [ 'BAR' ] ,
268268 BAR : [ 'FOO' ]
269269 } , {
270- state : 'FOO' ,
270+ current : 'FOO' ,
271271 obj : {
272272 foo : 'bar'
273273 }
@@ -295,9 +295,9 @@ describe('Statemachine', () => {
295295 test ( 'should have base state' , ( ) => {
296296
297297 type States = {
298- state : 'FOO'
298+ current : 'FOO'
299299 } | {
300- state : 'BAR'
300+ current : 'BAR'
301301 }
302302
303303 type Base = {
@@ -310,7 +310,7 @@ describe('Statemachine', () => {
310310 FOO : [ 'BAR' ] ,
311311 BAR : [ 'FOO' ]
312312 } , {
313- state : 'FOO' ,
313+ current : 'FOO' ,
314314 } , {
315315 obj : {
316316 foo : 'bar'
@@ -340,10 +340,10 @@ describe('Statemachine', () => {
340340 test ( 'should delete existing state and merge in new state, keep base' , ( ) => {
341341
342342 type States = {
343- state : 'FOO'
343+ current : 'FOO'
344344 foo : string
345345 } | {
346- state : 'BAR'
346+ current : 'BAR'
347347 bar : number
348348 }
349349
@@ -355,7 +355,7 @@ describe('Statemachine', () => {
355355 FOO : [ 'BAR' ] ,
356356 BAR : [ 'FOO' ]
357357 } , {
358- state : 'FOO' ,
358+ current : 'FOO' ,
359359 foo : 'bar'
360360 } , {
361361 baz : true
0 commit comments