@auto-engineer/server-generator-apollo-emmett 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +8 -0
- package/dist/src/codegen/extract/commands.d.ts +7 -14
- package/dist/src/codegen/extract/commands.d.ts.map +1 -1
- package/dist/src/codegen/extract/commands.js.map +1 -1
- package/dist/src/codegen/extract/data-sink.d.ts +1 -1
- package/dist/src/codegen/extract/data-sink.d.ts.map +1 -1
- package/dist/src/codegen/extract/data-sink.js +9 -31
- package/dist/src/codegen/extract/data-sink.js.map +1 -1
- package/dist/src/codegen/extract/events.d.ts +4 -8
- package/dist/src/codegen/extract/events.d.ts.map +1 -1
- package/dist/src/codegen/extract/events.js.map +1 -1
- package/dist/src/codegen/extract/gwt.d.ts +2 -2
- package/dist/src/codegen/extract/gwt.d.ts.map +1 -1
- package/dist/src/codegen/extract/gwt.js +6 -21
- package/dist/src/codegen/extract/gwt.js.map +1 -1
- package/dist/src/codegen/extract/messages.d.ts +4 -4
- package/dist/src/codegen/extract/messages.d.ts.map +1 -1
- package/dist/src/codegen/extract/messages.js +24 -47
- package/dist/src/codegen/extract/messages.js.map +1 -1
- package/dist/src/codegen/extract/query.d.ts +5 -7
- package/dist/src/codegen/extract/query.d.ts.map +1 -1
- package/dist/src/codegen/extract/query.js +10 -8
- package/dist/src/codegen/extract/query.js.map +1 -1
- package/dist/src/codegen/extract/slice-normalizer.d.ts +29 -0
- package/dist/src/codegen/extract/slice-normalizer.d.ts.map +1 -0
- package/dist/src/codegen/extract/slice-normalizer.js +48 -0
- package/dist/src/codegen/extract/slice-normalizer.js.map +1 -0
- package/dist/src/codegen/extract/step-converter.d.ts +17 -0
- package/dist/src/codegen/extract/step-converter.d.ts.map +1 -0
- package/dist/src/codegen/extract/step-converter.js +82 -0
- package/dist/src/codegen/extract/step-converter.js.map +1 -0
- package/dist/src/codegen/extract/step-types.d.ts +30 -0
- package/dist/src/codegen/extract/step-types.d.ts.map +1 -0
- package/dist/src/codegen/extract/step-types.js +16 -0
- package/dist/src/codegen/extract/step-types.js.map +1 -0
- package/dist/src/codegen/scaffoldFromSchema.d.ts.map +1 -1
- package/dist/src/codegen/scaffoldFromSchema.js +7 -29
- package/dist/src/codegen/scaffoldFromSchema.js.map +1 -1
- package/dist/src/codegen/templates/command/commands.specs.ts +33 -28
- package/dist/src/codegen/templates/command/decide.specs.specs.ts +153 -138
- package/dist/src/codegen/templates/command/decide.specs.ts +169 -146
- package/dist/src/codegen/templates/command/events.specs.ts +43 -38
- package/dist/src/codegen/templates/command/evolve.specs.ts +38 -33
- package/dist/src/codegen/templates/command/handle.specs.ts +71 -61
- package/dist/src/codegen/templates/command/mutation.resolver.specs.ts +122 -102
- package/dist/src/codegen/templates/command/register.specs.ts +39 -34
- package/dist/src/codegen/templates/command/state.specs.ts +39 -34
- package/dist/src/codegen/templates/query/projection.specs.specs.ts +399 -359
- package/dist/src/codegen/templates/query/projection.specs.ts +242 -216
- package/dist/src/codegen/templates/query/projection.specs.ts.ejs +38 -12
- package/dist/src/codegen/templates/query/query.resolver.specs.ts +59 -51
- package/dist/src/codegen/templates/query/state.specs.ts +1 -1
- package/dist/src/codegen/templates/react/react.specs.specs.ts +93 -85
- package/dist/src/codegen/templates/react/react.specs.ts +135 -122
- package/dist/src/codegen/templates/react/register.specs.ts +135 -122
- package/dist/src/codegen/test-data/specVariant1.d.ts.map +1 -1
- package/dist/src/codegen/test-data/specVariant1.js +101 -90
- package/dist/src/codegen/test-data/specVariant1.js.map +1 -1
- package/dist/src/codegen/types.d.ts +5 -7
- package/dist/src/codegen/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/codegen/extract/commands.ts +7 -8
- package/src/codegen/extract/data-sink.ts +16 -43
- package/src/codegen/extract/events.ts +4 -5
- package/src/codegen/extract/gwt.ts +12 -29
- package/src/codegen/extract/messages.ts +43 -70
- package/src/codegen/extract/query.ts +14 -12
- package/src/codegen/extract/slice-normalizer.ts +88 -0
- package/src/codegen/extract/step-converter.ts +124 -0
- package/src/codegen/extract/step-types.ts +52 -0
- package/src/codegen/scaffoldFromSchema.ts +8 -45
- package/src/codegen/templates/command/commands.specs.ts +33 -28
- package/src/codegen/templates/command/decide.specs.specs.ts +153 -138
- package/src/codegen/templates/command/decide.specs.ts +169 -146
- package/src/codegen/templates/command/events.specs.ts +43 -38
- package/src/codegen/templates/command/evolve.specs.ts +38 -33
- package/src/codegen/templates/command/handle.specs.ts +71 -61
- package/src/codegen/templates/command/mutation.resolver.specs.ts +122 -102
- package/src/codegen/templates/command/register.specs.ts +39 -34
- package/src/codegen/templates/command/state.specs.ts +39 -34
- package/src/codegen/templates/query/projection.specs.specs.ts +399 -359
- package/src/codegen/templates/query/projection.specs.ts +242 -216
- package/src/codegen/templates/query/projection.specs.ts.ejs +38 -12
- package/src/codegen/templates/query/query.resolver.specs.ts +59 -51
- package/src/codegen/templates/query/state.specs.ts +1 -1
- package/src/codegen/templates/react/react.specs.specs.ts +93 -85
- package/src/codegen/templates/react/react.specs.ts +135 -122
- package/src/codegen/templates/react/register.specs.ts +135 -122
- package/src/codegen/test-data/specVariant1.ts +101 -90
- package/src/codegen/types.ts +6 -4
|
@@ -19,56 +19,63 @@ describe('projection.ts.ejs', () => {
|
|
|
19
19
|
},
|
|
20
20
|
server: {
|
|
21
21
|
description: 'handles create/remove listing',
|
|
22
|
-
specs:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
specs: [
|
|
23
|
+
{
|
|
24
|
+
type: 'gherkin',
|
|
25
|
+
feature: 'Create/remove listing command',
|
|
26
|
+
rules: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Should handle listing operations',
|
|
29
|
+
examples: [
|
|
30
|
+
{
|
|
31
|
+
name: 'User creates listing successfully',
|
|
32
|
+
steps: [
|
|
33
|
+
{
|
|
34
|
+
keyword: 'When',
|
|
35
|
+
text: 'CreateListing',
|
|
36
|
+
docString: {
|
|
37
|
+
propertyId: 'listing_123',
|
|
38
|
+
title: 'Sea View Flat',
|
|
39
|
+
pricePerNight: 120,
|
|
40
|
+
location: 'Brighton',
|
|
41
|
+
maxGuests: 4,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
keyword: 'Then',
|
|
46
|
+
text: 'ListingCreated',
|
|
47
|
+
docString: {
|
|
48
|
+
propertyId: 'listing_123',
|
|
49
|
+
title: 'Sea View Flat',
|
|
50
|
+
pricePerNight: 120,
|
|
51
|
+
location: 'Brighton',
|
|
52
|
+
maxGuests: 4,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
39
56
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
{
|
|
58
|
+
name: 'User removes listing successfully',
|
|
59
|
+
steps: [
|
|
60
|
+
{
|
|
61
|
+
keyword: 'When',
|
|
62
|
+
text: 'RemoveListing',
|
|
63
|
+
docString: {
|
|
64
|
+
propertyId: 'listing_123',
|
|
65
|
+
},
|
|
49
66
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
commandRef: 'RemoveListing',
|
|
57
|
-
exampleData: {
|
|
58
|
-
propertyId: 'listing_123',
|
|
59
|
-
},
|
|
67
|
+
{
|
|
68
|
+
keyword: 'Then',
|
|
69
|
+
text: 'ListingRemoved',
|
|
70
|
+
docString: {},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
60
73
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
72
79
|
},
|
|
73
80
|
},
|
|
74
81
|
{
|
|
@@ -93,60 +100,63 @@ describe('projection.ts.ejs', () => {
|
|
|
93
100
|
},
|
|
94
101
|
},
|
|
95
102
|
],
|
|
96
|
-
specs:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
specs: [
|
|
104
|
+
{
|
|
105
|
+
type: 'gherkin',
|
|
106
|
+
feature: 'Search listings query',
|
|
107
|
+
rules: [
|
|
108
|
+
{
|
|
109
|
+
name: 'Should project listings correctly',
|
|
110
|
+
examples: [
|
|
111
|
+
{
|
|
112
|
+
name: 'Listing created shows in search results',
|
|
113
|
+
steps: [
|
|
114
|
+
{
|
|
115
|
+
keyword: 'When',
|
|
116
|
+
text: 'ListingCreated',
|
|
117
|
+
docString: {
|
|
118
|
+
propertyId: 'listing_123',
|
|
119
|
+
title: 'Sea View Flat',
|
|
120
|
+
pricePerNight: 120,
|
|
121
|
+
location: 'Brighton',
|
|
122
|
+
maxGuests: 4,
|
|
123
|
+
},
|
|
113
124
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
maxGuests: 4,
|
|
125
|
+
{
|
|
126
|
+
keyword: 'Then',
|
|
127
|
+
text: 'AvailableListings',
|
|
128
|
+
docString: {
|
|
129
|
+
propertyId: 'listing_123',
|
|
130
|
+
title: 'Sea View Flat',
|
|
131
|
+
pricePerNight: 120,
|
|
132
|
+
location: 'Brighton',
|
|
133
|
+
maxGuests: 4,
|
|
134
|
+
},
|
|
125
135
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'Listing removed disappears from search results',
|
|
140
|
+
steps: [
|
|
141
|
+
{
|
|
142
|
+
keyword: 'When',
|
|
143
|
+
text: 'ListingRemoved',
|
|
144
|
+
docString: {
|
|
145
|
+
propertyId: 'listing_123',
|
|
146
|
+
},
|
|
136
147
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
148
|
+
{
|
|
149
|
+
keyword: 'Then',
|
|
150
|
+
text: 'AvailableListings',
|
|
151
|
+
docString: {},
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
],
|
|
150
160
|
},
|
|
151
161
|
},
|
|
152
162
|
],
|
|
@@ -312,7 +322,7 @@ describe('projection.ts.ejs', () => {
|
|
|
312
322
|
},
|
|
313
323
|
},
|
|
314
324
|
],
|
|
315
|
-
specs:
|
|
325
|
+
specs: [],
|
|
316
326
|
},
|
|
317
327
|
},
|
|
318
328
|
],
|
|
@@ -395,35 +405,40 @@ describe('projection.ts.ejs', () => {
|
|
|
395
405
|
},
|
|
396
406
|
server: {
|
|
397
407
|
description: 'handles todo operations',
|
|
398
|
-
specs:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
exampleData: {
|
|
417
|
-
todoId: 'todo_123',
|
|
418
|
-
title: 'Buy milk',
|
|
408
|
+
specs: [
|
|
409
|
+
{
|
|
410
|
+
type: 'gherkin',
|
|
411
|
+
feature: 'Manage todo command',
|
|
412
|
+
rules: [
|
|
413
|
+
{
|
|
414
|
+
name: 'Should handle todo operations',
|
|
415
|
+
examples: [
|
|
416
|
+
{
|
|
417
|
+
name: 'User adds todo',
|
|
418
|
+
steps: [
|
|
419
|
+
{
|
|
420
|
+
keyword: 'When',
|
|
421
|
+
text: 'AddTodo',
|
|
422
|
+
docString: {
|
|
423
|
+
todoId: 'todo_123',
|
|
424
|
+
title: 'Buy milk',
|
|
425
|
+
},
|
|
419
426
|
},
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
+
{
|
|
428
|
+
keyword: 'Then',
|
|
429
|
+
text: 'TodoAdded',
|
|
430
|
+
docString: {
|
|
431
|
+
todoId: 'todo_123',
|
|
432
|
+
title: 'Buy milk',
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
],
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
],
|
|
427
442
|
},
|
|
428
443
|
},
|
|
429
444
|
{
|
|
@@ -448,36 +463,39 @@ describe('projection.ts.ejs', () => {
|
|
|
448
463
|
},
|
|
449
464
|
},
|
|
450
465
|
],
|
|
451
|
-
specs:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
466
|
+
specs: [
|
|
467
|
+
{
|
|
468
|
+
type: 'gherkin',
|
|
469
|
+
feature: 'View summary query',
|
|
470
|
+
rules: [
|
|
471
|
+
{
|
|
472
|
+
name: 'Should aggregate todo counts',
|
|
473
|
+
examples: [
|
|
474
|
+
{
|
|
475
|
+
name: 'Todo added updates count',
|
|
476
|
+
steps: [
|
|
477
|
+
{
|
|
478
|
+
keyword: 'When',
|
|
479
|
+
text: 'TodoAdded',
|
|
480
|
+
docString: {
|
|
481
|
+
todoId: 'todo_123',
|
|
482
|
+
title: 'Buy milk',
|
|
483
|
+
},
|
|
465
484
|
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
totalCount: 1,
|
|
485
|
+
{
|
|
486
|
+
keyword: 'Then',
|
|
487
|
+
text: 'TodoSummary',
|
|
488
|
+
docString: {
|
|
489
|
+
totalCount: 1,
|
|
490
|
+
},
|
|
473
491
|
},
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
492
|
+
],
|
|
493
|
+
},
|
|
494
|
+
],
|
|
495
|
+
},
|
|
496
|
+
],
|
|
497
|
+
},
|
|
498
|
+
],
|
|
481
499
|
},
|
|
482
500
|
},
|
|
483
501
|
],
|
|
@@ -600,37 +618,42 @@ describe('projection.ts.ejs', () => {
|
|
|
600
618
|
},
|
|
601
619
|
server: {
|
|
602
620
|
description: 'handles user project operations',
|
|
603
|
-
specs:
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
exampleData: {
|
|
623
|
-
userId: 'user_123',
|
|
624
|
-
projectId: 'proj_456',
|
|
625
|
-
role: 'developer',
|
|
621
|
+
specs: [
|
|
622
|
+
{
|
|
623
|
+
type: 'gherkin',
|
|
624
|
+
feature: 'Manage user project command',
|
|
625
|
+
rules: [
|
|
626
|
+
{
|
|
627
|
+
name: 'Should handle user project operations',
|
|
628
|
+
examples: [
|
|
629
|
+
{
|
|
630
|
+
name: 'User joins project',
|
|
631
|
+
steps: [
|
|
632
|
+
{
|
|
633
|
+
keyword: 'When',
|
|
634
|
+
text: 'JoinProject',
|
|
635
|
+
docString: {
|
|
636
|
+
userId: 'user_123',
|
|
637
|
+
projectId: 'proj_456',
|
|
638
|
+
role: 'developer',
|
|
639
|
+
},
|
|
626
640
|
},
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
641
|
+
{
|
|
642
|
+
keyword: 'Then',
|
|
643
|
+
text: 'UserJoinedProject',
|
|
644
|
+
docString: {
|
|
645
|
+
userId: 'user_123',
|
|
646
|
+
projectId: 'proj_456',
|
|
647
|
+
role: 'developer',
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
],
|
|
651
|
+
},
|
|
652
|
+
],
|
|
653
|
+
},
|
|
654
|
+
],
|
|
655
|
+
},
|
|
656
|
+
],
|
|
634
657
|
},
|
|
635
658
|
},
|
|
636
659
|
{
|
|
@@ -655,39 +678,42 @@ describe('projection.ts.ejs', () => {
|
|
|
655
678
|
},
|
|
656
679
|
},
|
|
657
680
|
],
|
|
658
|
-
specs:
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
681
|
+
specs: [
|
|
682
|
+
{
|
|
683
|
+
type: 'gherkin',
|
|
684
|
+
feature: 'View user projects query',
|
|
685
|
+
rules: [
|
|
686
|
+
{
|
|
687
|
+
name: 'Should track user project memberships',
|
|
688
|
+
examples: [
|
|
689
|
+
{
|
|
690
|
+
name: 'User joins project',
|
|
691
|
+
steps: [
|
|
692
|
+
{
|
|
693
|
+
keyword: 'When',
|
|
694
|
+
text: 'UserJoinedProject',
|
|
695
|
+
docString: {
|
|
696
|
+
userId: 'user_123',
|
|
697
|
+
projectId: 'proj_456',
|
|
698
|
+
role: 'developer',
|
|
699
|
+
},
|
|
673
700
|
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
role: 'developer',
|
|
701
|
+
{
|
|
702
|
+
keyword: 'Then',
|
|
703
|
+
text: 'UserProject',
|
|
704
|
+
docString: {
|
|
705
|
+
userId: 'user_123',
|
|
706
|
+
projectId: 'proj_456',
|
|
707
|
+
role: 'developer',
|
|
708
|
+
},
|
|
683
709
|
},
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
710
|
+
],
|
|
711
|
+
},
|
|
712
|
+
],
|
|
713
|
+
},
|
|
714
|
+
],
|
|
715
|
+
},
|
|
716
|
+
],
|
|
691
717
|
},
|
|
692
718
|
},
|
|
693
719
|
],
|
|
@@ -6,20 +6,46 @@ const idField = projectionIdField ?? 'id';
|
|
|
6
6
|
const uniqueEventTypes = allEventTypesArray;
|
|
7
7
|
|
|
8
8
|
const ruleGroups = new Map();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
|
|
10
|
+
if (Array.isArray(slice?.server?.specs)) {
|
|
11
|
+
for (const spec of slice.server.specs) {
|
|
12
|
+
const rules = spec.rules || [];
|
|
13
|
+
for (const rule of rules) {
|
|
14
|
+
const ruleDescription = rule.name || `${flowName} | ${sliceName}`;
|
|
15
|
+
if (!ruleGroups.has(ruleDescription)) {
|
|
16
|
+
ruleGroups.set(ruleDescription, []);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
for (const example of rule.examples || []) {
|
|
20
|
+
const givenSteps = example.steps?.filter(step => step.keyword === 'Given') || [];
|
|
21
|
+
const whenSteps = example.steps?.filter(step => step.keyword === 'When') || [];
|
|
22
|
+
const thenSteps = example.steps?.filter(step => step.keyword === 'Then') || [];
|
|
23
|
+
|
|
24
|
+
ruleGroups.get(ruleDescription).push({
|
|
25
|
+
description: example.name || 'should handle events correctly',
|
|
26
|
+
given: givenSteps.map(step => ({ eventRef: step.text, exampleData: step.docString || {} })),
|
|
27
|
+
when: whenSteps.map(step => ({ eventRef: step.text, exampleData: step.docString || {} })),
|
|
28
|
+
then: thenSteps.map(step => ({ stateRef: step.text, exampleData: step.docString || {} }))
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
14
32
|
}
|
|
33
|
+
} else {
|
|
34
|
+
const rules = slice?.server?.specs?.rules || [];
|
|
35
|
+
for (const rule of rules) {
|
|
36
|
+
const ruleDescription = rule.description || `${flowName} | ${sliceName}`;
|
|
37
|
+
if (!ruleGroups.has(ruleDescription)) {
|
|
38
|
+
ruleGroups.set(ruleDescription, []);
|
|
39
|
+
}
|
|
15
40
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
41
|
+
for (const example of rule.examples || []) {
|
|
42
|
+
ruleGroups.get(ruleDescription).push({
|
|
43
|
+
description: example.description || 'should handle events correctly',
|
|
44
|
+
given: example.given || [],
|
|
45
|
+
when: example.when || [],
|
|
46
|
+
then: example.then || []
|
|
47
|
+
});
|
|
48
|
+
}
|
|
23
49
|
}
|
|
24
50
|
}
|
|
25
51
|
_%>
|