@@ -40,8 +40,11 @@ describe('export to xstate', () => {
40
40
const expected : StateNodeConfig = {
41
41
initial : 'Second' ,
42
42
states : {
43
- First : { } ,
43
+ First : {
44
+ id : '05a22f1a' ,
45
+ } ,
44
46
Second : {
47
+ id : 'e54f9f9b' ,
45
48
on : {
46
49
SecondToFirst : 'First' ,
47
50
} ,
@@ -143,9 +146,7 @@ describe('export to xstate', () => {
143
146
144
147
const expected : StateNodeConfig = {
145
148
initial : 'First' ,
146
- states : {
147
- First : { } ,
148
- } ,
149
+ states : { First : { id : '27bd6ab5' } } ,
149
150
}
150
151
expect ( result ) . toEqual ( expected )
151
152
} )
@@ -185,12 +186,8 @@ describe('export to xstate', () => {
185
186
const expected : StateNodeConfig = {
186
187
initial : 'First' ,
187
188
states : {
188
- First : {
189
- on : {
190
- FirstToSecond : 'Second' ,
191
- } ,
192
- } ,
193
- Second : { } ,
189
+ First : { id : '27bd6ab5' , on : { FirstToSecond : 'Second' } } ,
190
+ Second : { id : '132835b3' } ,
194
191
} ,
195
192
}
196
193
expect ( result ) . toEqual ( expected )
@@ -226,7 +223,7 @@ describe('export to xstate', () => {
226
223
{
227
224
source : '132835b3' ,
228
225
target : '27bd6ab5' ,
229
- id : '2a553b4c ' ,
226
+ id : '27bd6ab5 ' ,
230
227
index : 2 ,
231
228
label : 'SecondToFirst' ,
232
229
} ,
@@ -238,16 +235,8 @@ describe('export to xstate', () => {
238
235
const expected : StateNodeConfig = {
239
236
initial : 'First' ,
240
237
states : {
241
- First : {
242
- on : {
243
- FirstToSecond : 'Second' ,
244
- } ,
245
- } ,
246
- Second : {
247
- on : {
248
- SecondToFirst : 'First' ,
249
- } ,
250
- } ,
238
+ First : { id : '27bd6ab5' , on : { FirstToSecond : 'Second' } } ,
239
+ Second : { id : '132835b3' , on : { SecondToFirst : 'First' } } ,
251
240
} ,
252
241
}
253
242
expect ( result ) . toEqual ( expected )
@@ -331,18 +320,21 @@ describe('export to xstate', () => {
331
320
initial : 'First' ,
332
321
states : {
333
322
First : {
323
+ id : '7d8ff3c3' ,
334
324
on : {
335
325
FirstToSecond : 'Second' ,
336
326
FirstToThird : 'Third' ,
337
327
} ,
338
328
} ,
339
329
Second : {
330
+ id : '37770e39' ,
340
331
on : {
341
332
SecondToFirst : 'First' ,
342
333
SecondToThird : 'Third' ,
343
334
} ,
344
335
} ,
345
336
Third : {
337
+ id : 'f7bef9df' ,
346
338
on : {
347
339
ThirdToFirst : 'First' ,
348
340
ThirdToSecond : 'Second' ,
@@ -399,14 +391,18 @@ describe('export to xstate', () => {
399
391
initial : 'First' ,
400
392
states : {
401
393
First : {
394
+ id : '97431d6f' ,
402
395
on : {
403
396
FirstToGroup : 'SecondGroup' ,
404
397
} ,
405
398
} ,
406
399
SecondGroup : {
400
+ id : 'ca850085' ,
407
401
initial : 'Third' ,
408
402
states : {
409
- Third : { } ,
403
+ Third : {
404
+ id : 'b66468dc' ,
405
+ } ,
410
406
} ,
411
407
} ,
412
408
} ,
@@ -429,7 +425,7 @@ describe('export to xstate', () => {
429
425
{
430
426
shape : 'state' ,
431
427
type : 'node' ,
432
- id : '97431d6f ' ,
428
+ id : 'b66468dc ' ,
433
429
index : 2 ,
434
430
initial : false ,
435
431
label : 'Second' ,
@@ -447,32 +443,26 @@ describe('export to xstate', () => {
447
443
} ,
448
444
] ,
449
445
groups : [
450
- {
451
- id : 'ca850085' ,
452
- index : 0 ,
453
- label : 'FirstGroup' ,
454
- initial : true ,
455
- } ,
446
+ { id : 'ca850085' , index : 0 , label : 'FirstGroup' , initial : true } ,
456
447
] ,
457
448
}
458
449
const result = exportToXState ( data )
459
450
const expected = {
460
451
initial : 'FirstGroup' ,
461
452
states : {
462
453
FirstGroup : {
454
+ id : 'ca850085' ,
463
455
initial : 'InnerFirst' ,
464
- on : {
465
- FirstToSecond : 'Second' ,
466
- } ,
467
- states : { InnerFirst : { } } ,
456
+ on : { FirstToSecond : 'Second' } ,
457
+ states : { InnerFirst : { id : 'b66468dc' } } ,
468
458
} ,
469
- Second : { } ,
459
+ Second : { id : 'b66468dc' } ,
470
460
} ,
471
461
}
472
462
expect ( result ) . toEqual ( expected )
473
463
} )
474
464
475
- // it('should ensure a nested state has an initial state ')
465
+ // it('should ensure a nested state has an initial s'tate ')
476
466
477
467
// it('should connect to a nested state within a nested state')
478
468
} )
@@ -521,9 +511,11 @@ describe('export to xstate', () => {
521
511
initial : 'Second' ,
522
512
states : {
523
513
First : {
514
+ id : '05a22f1a' ,
524
515
onEntry : [ 'enterFirst' ] ,
525
516
} ,
526
517
Second : {
518
+ id : 'e54f9f9b' ,
527
519
onEntry : [ 'enterSecond' ] ,
528
520
on : {
529
521
SecondToFirst : 'First' ,
@@ -572,9 +564,11 @@ describe('export to xstate', () => {
572
564
initial : 'Second' ,
573
565
states : {
574
566
First : {
567
+ id : '05a22f1a' ,
575
568
onExit : [ 'exitFirst' ] ,
576
569
} ,
577
570
Second : {
571
+ id : 'e54f9f9b' ,
578
572
onExit : [ 'exitSecond' ] ,
579
573
on : {
580
574
SecondToFirst : 'First' ,
@@ -620,12 +614,8 @@ describe('export to xstate', () => {
620
614
const expected : StateNodeConfig = {
621
615
initial : 'Second' ,
622
616
states : {
623
- First : { } ,
624
- Second : {
625
- on : {
626
- SecondToFirst : 'First' ,
627
- } ,
628
- } ,
617
+ First : { id : '05a22f1a' } ,
618
+ Second : { id : 'e54f9f9b' , on : { SecondToFirst : 'First' } } ,
629
619
} ,
630
620
}
631
621
expect ( result ) . toEqual ( expected )
@@ -665,14 +655,11 @@ describe('export to xstate', () => {
665
655
666
656
const expected : StateNodeConfig = {
667
657
initial : 'FirstGroup' ,
668
-
669
658
states : {
670
659
FirstGroup : {
660
+ id : 'ca850085' ,
671
661
parallel : true ,
672
- states : {
673
- Second : { } ,
674
- Third : { } ,
675
- } ,
662
+ states : { Second : { id : 'e54f9f9b' } , Third : { id : '05a22f1a' } } ,
676
663
} ,
677
664
} ,
678
665
}
0 commit comments