@auto-engineer/narrative 0.12.0 → 0.13.0
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 +24 -0
- package/dist/src/fluent-builder.d.ts.map +1 -1
- package/dist/src/fluent-builder.js +9 -12
- package/dist/src/fluent-builder.js.map +1 -1
- package/dist/src/getNarratives.specs.js +51 -35
- package/dist/src/getNarratives.specs.js.map +1 -1
- package/dist/src/id/addAutoIds.specs.js +12 -26
- package/dist/src/id/addAutoIds.specs.js.map +1 -1
- package/dist/src/id/generators.js +1 -1
- package/dist/src/id/generators.js.map +1 -1
- package/dist/src/id/hasAllIds.specs.js +28 -28
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/model-to-narrative.specs.js +132 -130
- package/dist/src/model-to-narrative.specs.js.map +1 -1
- package/dist/src/narrative-context.d.ts +4 -2
- package/dist/src/narrative-context.d.ts.map +1 -1
- package/dist/src/narrative-context.js +98 -95
- package/dist/src/narrative-context.js.map +1 -1
- package/dist/src/narrative.d.ts +7 -1
- package/dist/src/narrative.d.ts.map +1 -1
- package/dist/src/narrative.js +27 -6
- package/dist/src/narrative.js.map +1 -1
- package/dist/src/samples/items.narrative.js +7 -7
- package/dist/src/samples/items.narrative.js.map +1 -1
- package/dist/src/samples/place-order.narrative.js +4 -4
- package/dist/src/samples/place-order.narrative.js.map +1 -1
- package/dist/src/samples/questionnaires.narrative.js +26 -28
- package/dist/src/samples/questionnaires.narrative.js.map +1 -1
- package/dist/src/samples/seasonal-assistant.schema.json +37 -31
- package/dist/src/schema.d.ts +1156 -1527
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/schema.js +22 -24
- package/dist/src/schema.js.map +1 -1
- package/dist/src/slice-builder.js +2 -2
- package/dist/src/slice-builder.js.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/flow.d.ts.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/flow.js +34 -10
- package/dist/src/transformers/model-to-narrative/generators/flow.js.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.d.ts +1 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.d.ts.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.js +2 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.js.map +1 -1
- package/dist/src/transformers/narrative-to-model/index.d.ts.map +1 -1
- package/dist/src/transformers/narrative-to-model/index.js +4 -8
- package/dist/src/transformers/narrative-to-model/index.js.map +1 -1
- package/dist/src/transformers/narrative-to-model/type-inference.specs.js +3 -3
- package/dist/src/transformers/narrative-to-model/type-inference.specs.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/fluent-builder.ts +9 -12
- package/src/getNarratives.specs.ts +51 -36
- package/src/id/addAutoIds.specs.ts +12 -26
- package/src/id/generators.ts +1 -1
- package/src/id/hasAllIds.specs.ts +28 -28
- package/src/index.ts +4 -1
- package/src/model-to-narrative.specs.ts +132 -130
- package/src/narrative-context.ts +103 -101
- package/src/narrative.ts +44 -6
- package/src/samples/items.narrative.ts +7 -7
- package/src/samples/place-order.narrative.ts +4 -4
- package/src/samples/questionnaires.narrative.ts +27 -28
- package/src/samples/seasonal-assistant.schema.json +37 -31
- package/src/schema.ts +33 -24
- package/src/slice-builder.ts +2 -2
- package/src/transformers/model-to-narrative/generators/flow.ts +53 -23
- package/src/transformers/model-to-narrative/generators/imports.ts +2 -1
- package/src/transformers/narrative-to-model/index.ts +4 -7
- package/src/transformers/narrative-to-model/type-inference.specs.ts +3 -3
- package/.turbo/turbo-format.log +0 -4
- package/.turbo/turbo-lint.log +0 -4
- package/.turbo/turbo-test.log +0 -14
- package/.turbo/turbo-type-check.log +0 -4
|
@@ -10,13 +10,14 @@ describe('modelToNarrative', () => {
|
|
|
10
10
|
expect(code).toEqual(`import {
|
|
11
11
|
command,
|
|
12
12
|
data,
|
|
13
|
+
describe,
|
|
13
14
|
example,
|
|
14
15
|
gql,
|
|
16
|
+
it,
|
|
15
17
|
narrative,
|
|
16
18
|
query,
|
|
17
19
|
react,
|
|
18
20
|
rule,
|
|
19
|
-
should,
|
|
20
21
|
sink,
|
|
21
22
|
source,
|
|
22
23
|
specs,
|
|
@@ -92,13 +93,13 @@ type ItemsAddedToCart = Event<
|
|
|
92
93
|
narrative('Seasonal Assistant', () => {
|
|
93
94
|
command('enters shopping criteria into assistant')
|
|
94
95
|
.client(() => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
describe('Assistant Chat Interface', () => {
|
|
97
|
+
it('allow shopper to describe their shopping needs in natural language');
|
|
98
|
+
it('provide a text input for entering criteria');
|
|
99
|
+
it('show examples of what to include (age, interests, budget)');
|
|
100
|
+
it('show a button to submit the criteria');
|
|
101
|
+
it('generate a persisted session id for a visit');
|
|
102
|
+
it('show the header on top of the page');
|
|
102
103
|
});
|
|
103
104
|
})
|
|
104
105
|
.request(
|
|
@@ -236,11 +237,11 @@ narrative('Seasonal Assistant', () => {
|
|
|
236
237
|
});
|
|
237
238
|
query('views suggested items')
|
|
238
239
|
.client(() => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
describe('Suggested Items Screen', () => {
|
|
241
|
+
it('display all suggested items with names and reasons');
|
|
242
|
+
it('show quantity selectors for each item');
|
|
243
|
+
it('have an "Add to Cart" button for selected items');
|
|
244
|
+
it('allow removing items from the suggestions');
|
|
244
245
|
});
|
|
245
246
|
})
|
|
246
247
|
.request(
|
|
@@ -323,10 +324,10 @@ narrative('Seasonal Assistant', () => {
|
|
|
323
324
|
});
|
|
324
325
|
command('accepts items and adds to their cart')
|
|
325
326
|
.client(() => {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
describe('Suggested Items Screen', () => {
|
|
328
|
+
it('allow selecting specific items to add');
|
|
329
|
+
it('update quantities before adding to cart');
|
|
330
|
+
it('provide feedback when items are added');
|
|
330
331
|
});
|
|
331
332
|
})
|
|
332
333
|
.server(() => {
|
|
@@ -372,10 +373,10 @@ narrative('Seasonal Assistant', () => {
|
|
|
372
373
|
id: 'EXP-001',
|
|
373
374
|
type: 'experience',
|
|
374
375
|
client: {
|
|
375
|
-
specs:
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
specs: [
|
|
377
|
+
{ type: 'it', title: 'show a hero section with a welcome message' },
|
|
378
|
+
{ type: 'it', title: 'allow user to start the questionnaire' },
|
|
379
|
+
],
|
|
379
380
|
},
|
|
380
381
|
},
|
|
381
382
|
],
|
|
@@ -387,13 +388,11 @@ narrative('Seasonal Assistant', () => {
|
|
|
387
388
|
|
|
388
389
|
const code = await modelToNarrative(experienceModel);
|
|
389
390
|
|
|
390
|
-
expect(code).toEqual(`import { experience,
|
|
391
|
+
expect(code).toEqual(`import { experience, it, narrative } from '@auto-engineer/narrative';
|
|
391
392
|
narrative('Test Experience Flow', 'TEST-001', () => {
|
|
392
393
|
experience('Homepage', 'EXP-001').client(() => {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
should('allow user to start the questionnaire');
|
|
396
|
-
});
|
|
394
|
+
it('show a hero section with a welcome message');
|
|
395
|
+
it('allow user to start the questionnaire');
|
|
397
396
|
});
|
|
398
397
|
});
|
|
399
398
|
`);
|
|
@@ -412,10 +411,16 @@ narrative('Test Experience Flow', 'TEST-001', () => {
|
|
|
412
411
|
// id: undefined - no ID
|
|
413
412
|
type: 'experience',
|
|
414
413
|
client: {
|
|
415
|
-
specs:
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
414
|
+
specs: [
|
|
415
|
+
{
|
|
416
|
+
type: 'describe',
|
|
417
|
+
title: 'Homepage specs',
|
|
418
|
+
children: [
|
|
419
|
+
{ type: 'it', title: 'show welcome message' },
|
|
420
|
+
{ type: 'it', title: 'display navigation' },
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
],
|
|
419
424
|
},
|
|
420
425
|
},
|
|
421
426
|
],
|
|
@@ -427,12 +432,12 @@ narrative('Test Experience Flow', 'TEST-001', () => {
|
|
|
427
432
|
|
|
428
433
|
const code = await modelToNarrative(modelWithoutIds);
|
|
429
434
|
|
|
430
|
-
expect(code).toEqual(`import {
|
|
435
|
+
expect(code).toEqual(`import { describe, experience, it, narrative } from '@auto-engineer/narrative';
|
|
431
436
|
narrative('Test Flow without IDs', () => {
|
|
432
437
|
experience('Homepage').client(() => {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
438
|
+
describe('Homepage specs', () => {
|
|
439
|
+
it('show welcome message');
|
|
440
|
+
it('display navigation');
|
|
436
441
|
});
|
|
437
442
|
});
|
|
438
443
|
});
|
|
@@ -452,10 +457,16 @@ narrative('Test Flow without IDs', () => {
|
|
|
452
457
|
id: 'SLICE-ABC',
|
|
453
458
|
type: 'experience',
|
|
454
459
|
client: {
|
|
455
|
-
specs:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
460
|
+
specs: [
|
|
461
|
+
{
|
|
462
|
+
type: 'describe',
|
|
463
|
+
title: 'Homepage specs',
|
|
464
|
+
children: [
|
|
465
|
+
{ type: 'it', title: 'show welcome message' },
|
|
466
|
+
{ type: 'it', title: 'display navigation' },
|
|
467
|
+
],
|
|
468
|
+
},
|
|
469
|
+
],
|
|
459
470
|
},
|
|
460
471
|
},
|
|
461
472
|
{
|
|
@@ -463,11 +474,16 @@ narrative('Test Flow without IDs', () => {
|
|
|
463
474
|
id: 'SLICE-XYZ',
|
|
464
475
|
type: 'query',
|
|
465
476
|
client: {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
477
|
+
specs: [
|
|
478
|
+
{
|
|
479
|
+
type: 'describe',
|
|
480
|
+
title: 'Product list specs',
|
|
481
|
+
children: [
|
|
482
|
+
{ type: 'it', title: 'display all products' },
|
|
483
|
+
{ type: 'it', title: 'allow filtering' },
|
|
484
|
+
],
|
|
485
|
+
},
|
|
486
|
+
],
|
|
471
487
|
},
|
|
472
488
|
server: {
|
|
473
489
|
description: 'Product query server',
|
|
@@ -486,19 +502,19 @@ narrative('Test Flow without IDs', () => {
|
|
|
486
502
|
|
|
487
503
|
const code = await modelToNarrative(modelWithIds);
|
|
488
504
|
|
|
489
|
-
expect(code).toEqual(`import { experience, narrative, query,
|
|
505
|
+
expect(code).toEqual(`import { describe, experience, it, narrative, query, specs } from '@auto-engineer/narrative';
|
|
490
506
|
narrative('Test Flow with IDs', 'FLOW-123', () => {
|
|
491
507
|
experience('Homepage', 'SLICE-ABC').client(() => {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
508
|
+
describe('Homepage specs', () => {
|
|
509
|
+
it('show welcome message');
|
|
510
|
+
it('display navigation');
|
|
495
511
|
});
|
|
496
512
|
});
|
|
497
513
|
query('view products', 'SLICE-XYZ')
|
|
498
514
|
.client(() => {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
515
|
+
describe('Product list specs', () => {
|
|
516
|
+
it('display all products');
|
|
517
|
+
it('allow filtering');
|
|
502
518
|
});
|
|
503
519
|
})
|
|
504
520
|
.server(() => {
|
|
@@ -521,7 +537,7 @@ narrative('Test Flow with IDs', 'FLOW-123', () => {
|
|
|
521
537
|
id: 'SLICE-789',
|
|
522
538
|
type: 'command',
|
|
523
539
|
client: {
|
|
524
|
-
|
|
540
|
+
specs: [],
|
|
525
541
|
},
|
|
526
542
|
server: {
|
|
527
543
|
description: 'Command processing server',
|
|
@@ -683,34 +699,36 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
|
|
|
683
699
|
narratives: [
|
|
684
700
|
{
|
|
685
701
|
name: 'Questionnaires',
|
|
686
|
-
id: '
|
|
702
|
+
id: 'Q9m2Kp4Lx',
|
|
687
703
|
slices: [
|
|
688
704
|
{
|
|
689
705
|
name: 'Homepage',
|
|
690
|
-
id: '
|
|
706
|
+
id: 'H1a4Bn6Cy',
|
|
691
707
|
type: 'experience',
|
|
692
708
|
client: {
|
|
693
|
-
specs:
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
709
|
+
specs: [
|
|
710
|
+
{ type: 'it', title: 'show a hero section with a welcome message' },
|
|
711
|
+
{ type: 'it', title: 'allow user to start the questionnaire' },
|
|
712
|
+
],
|
|
697
713
|
},
|
|
698
714
|
},
|
|
699
715
|
{
|
|
700
716
|
name: 'views the questionnaire',
|
|
701
|
-
id: '
|
|
717
|
+
id: 'V7n8Rq5M',
|
|
702
718
|
type: 'query',
|
|
703
719
|
client: {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
720
|
+
specs: [
|
|
721
|
+
{
|
|
722
|
+
type: 'describe',
|
|
723
|
+
title: 'Questionnaire Progress',
|
|
724
|
+
children: [
|
|
725
|
+
{ type: 'it', title: 'focus on the current question based on the progress state' },
|
|
726
|
+
{ type: 'it', title: 'display the list of answered questions' },
|
|
727
|
+
{ type: 'it', title: 'display the list of remaining questions' },
|
|
728
|
+
{ type: 'it', title: 'show a progress indicator that is always visible as the user scrolls' },
|
|
729
|
+
],
|
|
730
|
+
},
|
|
731
|
+
],
|
|
714
732
|
},
|
|
715
733
|
request:
|
|
716
734
|
'query QuestionnaireProgress($participantId: ID!) {\n questionnaireProgress(participantId: $participantId) {\n questionnaireId\n participantId\n currentQuestionId\n remainingQuestions\n status\n answers {\n questionId\n value\n }\n }\n}',
|
|
@@ -733,7 +751,7 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
|
|
|
733
751
|
name: '',
|
|
734
752
|
rules: [
|
|
735
753
|
{
|
|
736
|
-
id: '
|
|
754
|
+
id: 'r1A3Bp9W',
|
|
737
755
|
description: 'questionnaires show current progress',
|
|
738
756
|
examples: [
|
|
739
757
|
{
|
|
@@ -900,13 +918,14 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
|
|
|
900
918
|
|
|
901
919
|
expect(code).toEqual(`import {
|
|
902
920
|
data,
|
|
921
|
+
describe,
|
|
903
922
|
example,
|
|
904
923
|
experience,
|
|
905
924
|
gql,
|
|
925
|
+
it,
|
|
906
926
|
narrative,
|
|
907
927
|
query,
|
|
908
928
|
rule,
|
|
909
|
-
should,
|
|
910
929
|
source,
|
|
911
930
|
specs,
|
|
912
931
|
} from '@auto-engineer/narrative';
|
|
@@ -944,20 +963,18 @@ type QuestionnaireProgress = State<
|
|
|
944
963
|
}[];
|
|
945
964
|
}
|
|
946
965
|
>;
|
|
947
|
-
narrative('Questionnaires', '
|
|
948
|
-
experience('Homepage', '
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
should('allow user to start the questionnaire');
|
|
952
|
-
});
|
|
966
|
+
narrative('Questionnaires', 'Q9m2Kp4Lx', () => {
|
|
967
|
+
experience('Homepage', 'H1a4Bn6Cy').client(() => {
|
|
968
|
+
it('show a hero section with a welcome message');
|
|
969
|
+
it('allow user to start the questionnaire');
|
|
953
970
|
});
|
|
954
|
-
query('views the questionnaire', '
|
|
971
|
+
query('views the questionnaire', 'V7n8Rq5M')
|
|
955
972
|
.client(() => {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
973
|
+
describe('Questionnaire Progress', () => {
|
|
974
|
+
it('focus on the current question based on the progress state');
|
|
975
|
+
it('display the list of answered questions');
|
|
976
|
+
it('display the list of remaining questions');
|
|
977
|
+
it('show a progress indicator that is always visible as the user scrolls');
|
|
961
978
|
});
|
|
962
979
|
})
|
|
963
980
|
.request(
|
|
@@ -978,7 +995,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
|
|
|
978
995
|
.server(() => {
|
|
979
996
|
data([source().state('QuestionnaireProgress').fromProjection('Questionnaires', 'questionnaire-participantId')]);
|
|
980
997
|
specs(() => {
|
|
981
|
-
rule('questionnaires show current progress', '
|
|
998
|
+
rule('questionnaires show current progress', 'r1A3Bp9W', () => {
|
|
982
999
|
example('a question has already been answered')
|
|
983
1000
|
.given<QuestionnaireLinkSent>({
|
|
984
1001
|
questionnaireId: 'q-001',
|
|
@@ -1021,7 +1038,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
|
|
|
1021
1038
|
id: 'TEST-SLICE',
|
|
1022
1039
|
type: 'query',
|
|
1023
1040
|
client: {
|
|
1024
|
-
|
|
1041
|
+
specs: [],
|
|
1025
1042
|
},
|
|
1026
1043
|
server: {
|
|
1027
1044
|
description: 'Test server for duplicate rules',
|
|
@@ -1029,7 +1046,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
|
|
|
1029
1046
|
name: 'Test Rules',
|
|
1030
1047
|
rules: [
|
|
1031
1048
|
{
|
|
1032
|
-
id: '
|
|
1049
|
+
id: 'r1A3Bp9W',
|
|
1033
1050
|
description: 'questionnaires show current progress',
|
|
1034
1051
|
examples: [
|
|
1035
1052
|
{
|
|
@@ -1159,7 +1176,7 @@ type QuestionnaireProgress = State<
|
|
|
1159
1176
|
narrative('Test Flow', 'TEST-FLOW', () => {
|
|
1160
1177
|
query('test slice', 'TEST-SLICE').server(() => {
|
|
1161
1178
|
specs('Test Rules', () => {
|
|
1162
|
-
rule('questionnaires show current progress', '
|
|
1179
|
+
rule('questionnaires show current progress', 'r1A3Bp9W', () => {
|
|
1163
1180
|
example('a question has already been answered')
|
|
1164
1181
|
.given<QuestionnaireLinkSent>({ questionnaireId: 'q-001', participantId: 'participant-abc' })
|
|
1165
1182
|
.when<QuestionAnswered>({ questionnaireId: 'q-001', questionId: 'q1', answer: 'Yes' })
|
|
@@ -1188,7 +1205,7 @@ narrative('Test Flow', 'TEST-FLOW', () => {
|
|
|
1188
1205
|
id: 'MULTI-SLICE',
|
|
1189
1206
|
type: 'query',
|
|
1190
1207
|
client: {
|
|
1191
|
-
|
|
1208
|
+
specs: [],
|
|
1192
1209
|
},
|
|
1193
1210
|
server: {
|
|
1194
1211
|
description: 'Multi given server rules',
|
|
@@ -1196,7 +1213,7 @@ narrative('Test Flow', 'TEST-FLOW', () => {
|
|
|
1196
1213
|
name: 'Multi Given Rules',
|
|
1197
1214
|
rules: [
|
|
1198
1215
|
{
|
|
1199
|
-
id: '
|
|
1216
|
+
id: 'MultiGiven',
|
|
1200
1217
|
description: 'all questions have been answered',
|
|
1201
1218
|
examples: [
|
|
1202
1219
|
{
|
|
@@ -1374,7 +1391,7 @@ type QuestionnaireProgress = State<
|
|
|
1374
1391
|
narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
|
|
1375
1392
|
query('multi given slice', 'MULTI-SLICE').server(() => {
|
|
1376
1393
|
specs('Multi Given Rules', () => {
|
|
1377
|
-
rule('all questions have been answered', '
|
|
1394
|
+
rule('all questions have been answered', 'MultiGiven', () => {
|
|
1378
1395
|
example('questionnaire with multiple events')
|
|
1379
1396
|
.given<QuestionnaireConfig>({ questionnaireId: 'q-001', numberOfQuestions: 3 })
|
|
1380
1397
|
.and<QuestionnaireLinkSent>({
|
|
@@ -1435,7 +1452,7 @@ narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
|
|
|
1435
1452
|
id: 'REF-SLICE',
|
|
1436
1453
|
type: 'query',
|
|
1437
1454
|
client: {
|
|
1438
|
-
|
|
1455
|
+
specs: [],
|
|
1439
1456
|
},
|
|
1440
1457
|
server: {
|
|
1441
1458
|
description: 'Server for referenced states',
|
|
@@ -1467,7 +1484,7 @@ narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
|
|
|
1467
1484
|
name: 'Database State Rules',
|
|
1468
1485
|
rules: [
|
|
1469
1486
|
{
|
|
1470
|
-
id: '
|
|
1487
|
+
id: 'RefState',
|
|
1471
1488
|
description: 'questionnaire config is available when referenced',
|
|
1472
1489
|
examples: [
|
|
1473
1490
|
{
|
|
@@ -1562,7 +1579,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
|
|
|
1562
1579
|
source().state('QuestionnaireConfig').fromDatabase('ConfigStore', { questionnaireId: '$questionnaireId' }),
|
|
1563
1580
|
]);
|
|
1564
1581
|
specs('Database State Rules', () => {
|
|
1565
|
-
rule('questionnaire config is available when referenced', '
|
|
1582
|
+
rule('questionnaire config is available when referenced', 'RefState', () => {
|
|
1566
1583
|
example('config from database is accessible')
|
|
1567
1584
|
.given<QuestionnaireConfig>({
|
|
1568
1585
|
questionnaireId: 'q-001',
|
|
@@ -1596,7 +1613,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
|
|
|
1596
1613
|
id: 'DATE-SLICE',
|
|
1597
1614
|
type: 'query',
|
|
1598
1615
|
client: {
|
|
1599
|
-
|
|
1616
|
+
specs: [],
|
|
1600
1617
|
},
|
|
1601
1618
|
server: {
|
|
1602
1619
|
description: 'Date server with Date fields',
|
|
@@ -1604,7 +1621,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
|
|
|
1604
1621
|
name: 'Date Field Rules',
|
|
1605
1622
|
rules: [
|
|
1606
1623
|
{
|
|
1607
|
-
id: '
|
|
1624
|
+
id: 'DateRule',
|
|
1608
1625
|
description: 'handles Date fields correctly',
|
|
1609
1626
|
examples: [
|
|
1610
1627
|
{
|
|
@@ -1713,7 +1730,7 @@ type ProcessState = State<
|
|
|
1713
1730
|
narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
1714
1731
|
query('date handling slice', 'DATE-SLICE').server(() => {
|
|
1715
1732
|
specs('Date Field Rules', () => {
|
|
1716
|
-
rule('handles Date fields correctly', '
|
|
1733
|
+
rule('handles Date fields correctly', 'DateRule', () => {
|
|
1717
1734
|
example('event with Date fields')
|
|
1718
1735
|
.given<TimestampedEvent>({
|
|
1719
1736
|
id: 'event-123',
|
|
@@ -1745,13 +1762,10 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1745
1762
|
slices: [
|
|
1746
1763
|
{
|
|
1747
1764
|
name: 'Active Surveys Summary',
|
|
1748
|
-
id: '
|
|
1765
|
+
id: 'aifPcU3hw',
|
|
1749
1766
|
type: 'experience',
|
|
1750
1767
|
client: {
|
|
1751
|
-
specs: {
|
|
1752
|
-
name: '',
|
|
1753
|
-
rules: ['show active surveys summary'],
|
|
1754
|
-
},
|
|
1768
|
+
specs: [{ type: 'it', title: 'show active surveys summary' }],
|
|
1755
1769
|
},
|
|
1756
1770
|
},
|
|
1757
1771
|
],
|
|
@@ -1762,13 +1776,10 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1762
1776
|
slices: [
|
|
1763
1777
|
{
|
|
1764
1778
|
name: 'Create Survey Form',
|
|
1765
|
-
id: '
|
|
1779
|
+
id: 'MPviTMrQC',
|
|
1766
1780
|
type: 'experience',
|
|
1767
1781
|
client: {
|
|
1768
|
-
specs: {
|
|
1769
|
-
name: '',
|
|
1770
|
-
rules: ['allow entering survey title'],
|
|
1771
|
-
},
|
|
1782
|
+
specs: [{ type: 'it', title: 'allow entering survey title' }],
|
|
1772
1783
|
},
|
|
1773
1784
|
},
|
|
1774
1785
|
],
|
|
@@ -1779,13 +1790,10 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1779
1790
|
slices: [
|
|
1780
1791
|
{
|
|
1781
1792
|
name: 'Response Rate Charts',
|
|
1782
|
-
id: '
|
|
1793
|
+
id: 'eME978Euk',
|
|
1783
1794
|
type: 'experience',
|
|
1784
1795
|
client: {
|
|
1785
|
-
specs: {
|
|
1786
|
-
name: '',
|
|
1787
|
-
rules: ['show daily response rate charts'],
|
|
1788
|
-
},
|
|
1796
|
+
specs: [{ type: 'it', title: 'show daily response rate charts' }],
|
|
1789
1797
|
},
|
|
1790
1798
|
},
|
|
1791
1799
|
],
|
|
@@ -1797,26 +1805,20 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1797
1805
|
|
|
1798
1806
|
const code = await modelToNarrative(modelWithMultipleFlowsSameSource);
|
|
1799
1807
|
|
|
1800
|
-
expect(code).toEqual(`import { experience,
|
|
1808
|
+
expect(code).toEqual(`import { experience, it, narrative } from '@auto-engineer/narrative';
|
|
1801
1809
|
narrative('Home Screen', () => {
|
|
1802
|
-
experience('Active Surveys Summary', '
|
|
1803
|
-
|
|
1804
|
-
should('show active surveys summary');
|
|
1805
|
-
});
|
|
1810
|
+
experience('Active Surveys Summary', 'aifPcU3hw').client(() => {
|
|
1811
|
+
it('show active surveys summary');
|
|
1806
1812
|
});
|
|
1807
1813
|
});
|
|
1808
1814
|
narrative('Create Survey', () => {
|
|
1809
|
-
experience('Create Survey Form', '
|
|
1810
|
-
|
|
1811
|
-
should('allow entering survey title');
|
|
1812
|
-
});
|
|
1815
|
+
experience('Create Survey Form', 'MPviTMrQC').client(() => {
|
|
1816
|
+
it('allow entering survey title');
|
|
1813
1817
|
});
|
|
1814
1818
|
});
|
|
1815
1819
|
narrative('Response Analytics', () => {
|
|
1816
|
-
experience('Response Rate Charts', '
|
|
1817
|
-
|
|
1818
|
-
should('show daily response rate charts');
|
|
1819
|
-
});
|
|
1820
|
+
experience('Response Rate Charts', 'eME978Euk').client(() => {
|
|
1821
|
+
it('show daily response rate charts');
|
|
1820
1822
|
});
|
|
1821
1823
|
});
|
|
1822
1824
|
`);
|
|
@@ -1835,7 +1837,7 @@ narrative('Response Analytics', () => {
|
|
|
1835
1837
|
id: 'SUMMARY-001',
|
|
1836
1838
|
type: 'query',
|
|
1837
1839
|
client: {
|
|
1838
|
-
|
|
1840
|
+
specs: [],
|
|
1839
1841
|
},
|
|
1840
1842
|
server: {
|
|
1841
1843
|
description: 'Summary calculation server',
|
|
@@ -2048,7 +2050,7 @@ narrative('Todo List Summary', 'TODO-001', () => {
|
|
|
2048
2050
|
id: 'SUMMARY-SLICE',
|
|
2049
2051
|
type: 'query',
|
|
2050
2052
|
client: {
|
|
2051
|
-
|
|
2053
|
+
specs: [],
|
|
2052
2054
|
},
|
|
2053
2055
|
server: {
|
|
2054
2056
|
description: 'Summary server',
|
|
@@ -2121,7 +2123,7 @@ narrative('Todo Summary Flow', 'TODO-SUMMARY', () => {
|
|
|
2121
2123
|
id: 'TODO-SLICE',
|
|
2122
2124
|
type: 'query',
|
|
2123
2125
|
client: {
|
|
2124
|
-
|
|
2126
|
+
specs: [],
|
|
2125
2127
|
},
|
|
2126
2128
|
server: {
|
|
2127
2129
|
description: 'Todo server',
|
|
@@ -2194,7 +2196,7 @@ narrative('Todo Flow', 'TODO-FLOW', () => {
|
|
|
2194
2196
|
id: 'USER-PROJECT-SLICE',
|
|
2195
2197
|
type: 'query',
|
|
2196
2198
|
client: {
|
|
2197
|
-
|
|
2199
|
+
specs: [],
|
|
2198
2200
|
},
|
|
2199
2201
|
server: {
|
|
2200
2202
|
description: 'User project server',
|
|
@@ -2269,7 +2271,7 @@ narrative('User Project Flow', 'USER-PROJECT-FLOW', () => {
|
|
|
2269
2271
|
id: 'SUMMARY-SLICE',
|
|
2270
2272
|
type: 'query',
|
|
2271
2273
|
client: {
|
|
2272
|
-
|
|
2274
|
+
specs: [],
|
|
2273
2275
|
},
|
|
2274
2276
|
server: {
|
|
2275
2277
|
description: 'Summary server',
|
|
@@ -2297,7 +2299,7 @@ narrative('User Project Flow', 'USER-PROJECT-FLOW', () => {
|
|
|
2297
2299
|
id: 'TODO-SLICE',
|
|
2298
2300
|
type: 'query',
|
|
2299
2301
|
client: {
|
|
2300
|
-
|
|
2302
|
+
specs: [],
|
|
2301
2303
|
},
|
|
2302
2304
|
server: {
|
|
2303
2305
|
description: 'Todo server',
|
|
@@ -2325,7 +2327,7 @@ narrative('User Project Flow', 'USER-PROJECT-FLOW', () => {
|
|
|
2325
2327
|
id: 'USER-PROJECT-SLICE',
|
|
2326
2328
|
type: 'query',
|
|
2327
2329
|
client: {
|
|
2328
|
-
|
|
2330
|
+
specs: [],
|
|
2329
2331
|
},
|
|
2330
2332
|
server: {
|
|
2331
2333
|
description: 'User project server',
|