@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
|
@@ -7,13 +7,14 @@ describe('modelToNarrative', () => {
|
|
|
7
7
|
expect(code).toEqual(`import {
|
|
8
8
|
command,
|
|
9
9
|
data,
|
|
10
|
+
describe,
|
|
10
11
|
example,
|
|
11
12
|
gql,
|
|
13
|
+
it,
|
|
12
14
|
narrative,
|
|
13
15
|
query,
|
|
14
16
|
react,
|
|
15
17
|
rule,
|
|
16
|
-
should,
|
|
17
18
|
sink,
|
|
18
19
|
source,
|
|
19
20
|
specs,
|
|
@@ -89,13 +90,13 @@ type ItemsAddedToCart = Event<
|
|
|
89
90
|
narrative('Seasonal Assistant', () => {
|
|
90
91
|
command('enters shopping criteria into assistant')
|
|
91
92
|
.client(() => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
describe('Assistant Chat Interface', () => {
|
|
94
|
+
it('allow shopper to describe their shopping needs in natural language');
|
|
95
|
+
it('provide a text input for entering criteria');
|
|
96
|
+
it('show examples of what to include (age, interests, budget)');
|
|
97
|
+
it('show a button to submit the criteria');
|
|
98
|
+
it('generate a persisted session id for a visit');
|
|
99
|
+
it('show the header on top of the page');
|
|
99
100
|
});
|
|
100
101
|
})
|
|
101
102
|
.request(
|
|
@@ -233,11 +234,11 @@ narrative('Seasonal Assistant', () => {
|
|
|
233
234
|
});
|
|
234
235
|
query('views suggested items')
|
|
235
236
|
.client(() => {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
describe('Suggested Items Screen', () => {
|
|
238
|
+
it('display all suggested items with names and reasons');
|
|
239
|
+
it('show quantity selectors for each item');
|
|
240
|
+
it('have an "Add to Cart" button for selected items');
|
|
241
|
+
it('allow removing items from the suggestions');
|
|
241
242
|
});
|
|
242
243
|
})
|
|
243
244
|
.request(
|
|
@@ -320,10 +321,10 @@ narrative('Seasonal Assistant', () => {
|
|
|
320
321
|
});
|
|
321
322
|
command('accepts items and adds to their cart')
|
|
322
323
|
.client(() => {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
describe('Suggested Items Screen', () => {
|
|
325
|
+
it('allow selecting specific items to add');
|
|
326
|
+
it('update quantities before adding to cart');
|
|
327
|
+
it('provide feedback when items are added');
|
|
327
328
|
});
|
|
328
329
|
})
|
|
329
330
|
.server(() => {
|
|
@@ -368,10 +369,10 @@ narrative('Seasonal Assistant', () => {
|
|
|
368
369
|
id: 'EXP-001',
|
|
369
370
|
type: 'experience',
|
|
370
371
|
client: {
|
|
371
|
-
specs:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
specs: [
|
|
373
|
+
{ type: 'it', title: 'show a hero section with a welcome message' },
|
|
374
|
+
{ type: 'it', title: 'allow user to start the questionnaire' },
|
|
375
|
+
],
|
|
375
376
|
},
|
|
376
377
|
},
|
|
377
378
|
],
|
|
@@ -381,13 +382,11 @@ narrative('Seasonal Assistant', () => {
|
|
|
381
382
|
integrations: [],
|
|
382
383
|
};
|
|
383
384
|
const code = await modelToNarrative(experienceModel);
|
|
384
|
-
expect(code).toEqual(`import { experience,
|
|
385
|
+
expect(code).toEqual(`import { experience, it, narrative } from '@auto-engineer/narrative';
|
|
385
386
|
narrative('Test Experience Flow', 'TEST-001', () => {
|
|
386
387
|
experience('Homepage', 'EXP-001').client(() => {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
should('allow user to start the questionnaire');
|
|
390
|
-
});
|
|
388
|
+
it('show a hero section with a welcome message');
|
|
389
|
+
it('allow user to start the questionnaire');
|
|
391
390
|
});
|
|
392
391
|
});
|
|
393
392
|
`);
|
|
@@ -405,10 +404,16 @@ narrative('Test Experience Flow', 'TEST-001', () => {
|
|
|
405
404
|
// id: undefined - no ID
|
|
406
405
|
type: 'experience',
|
|
407
406
|
client: {
|
|
408
|
-
specs:
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
specs: [
|
|
408
|
+
{
|
|
409
|
+
type: 'describe',
|
|
410
|
+
title: 'Homepage specs',
|
|
411
|
+
children: [
|
|
412
|
+
{ type: 'it', title: 'show welcome message' },
|
|
413
|
+
{ type: 'it', title: 'display navigation' },
|
|
414
|
+
],
|
|
415
|
+
},
|
|
416
|
+
],
|
|
412
417
|
},
|
|
413
418
|
},
|
|
414
419
|
],
|
|
@@ -418,12 +423,12 @@ narrative('Test Experience Flow', 'TEST-001', () => {
|
|
|
418
423
|
integrations: [],
|
|
419
424
|
};
|
|
420
425
|
const code = await modelToNarrative(modelWithoutIds);
|
|
421
|
-
expect(code).toEqual(`import {
|
|
426
|
+
expect(code).toEqual(`import { describe, experience, it, narrative } from '@auto-engineer/narrative';
|
|
422
427
|
narrative('Test Flow without IDs', () => {
|
|
423
428
|
experience('Homepage').client(() => {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
429
|
+
describe('Homepage specs', () => {
|
|
430
|
+
it('show welcome message');
|
|
431
|
+
it('display navigation');
|
|
427
432
|
});
|
|
428
433
|
});
|
|
429
434
|
});
|
|
@@ -442,10 +447,16 @@ narrative('Test Flow without IDs', () => {
|
|
|
442
447
|
id: 'SLICE-ABC',
|
|
443
448
|
type: 'experience',
|
|
444
449
|
client: {
|
|
445
|
-
specs:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
450
|
+
specs: [
|
|
451
|
+
{
|
|
452
|
+
type: 'describe',
|
|
453
|
+
title: 'Homepage specs',
|
|
454
|
+
children: [
|
|
455
|
+
{ type: 'it', title: 'show welcome message' },
|
|
456
|
+
{ type: 'it', title: 'display navigation' },
|
|
457
|
+
],
|
|
458
|
+
},
|
|
459
|
+
],
|
|
449
460
|
},
|
|
450
461
|
},
|
|
451
462
|
{
|
|
@@ -453,11 +464,16 @@ narrative('Test Flow without IDs', () => {
|
|
|
453
464
|
id: 'SLICE-XYZ',
|
|
454
465
|
type: 'query',
|
|
455
466
|
client: {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
467
|
+
specs: [
|
|
468
|
+
{
|
|
469
|
+
type: 'describe',
|
|
470
|
+
title: 'Product list specs',
|
|
471
|
+
children: [
|
|
472
|
+
{ type: 'it', title: 'display all products' },
|
|
473
|
+
{ type: 'it', title: 'allow filtering' },
|
|
474
|
+
],
|
|
475
|
+
},
|
|
476
|
+
],
|
|
461
477
|
},
|
|
462
478
|
server: {
|
|
463
479
|
description: 'Product query server',
|
|
@@ -474,19 +490,19 @@ narrative('Test Flow without IDs', () => {
|
|
|
474
490
|
integrations: [],
|
|
475
491
|
};
|
|
476
492
|
const code = await modelToNarrative(modelWithIds);
|
|
477
|
-
expect(code).toEqual(`import { experience, narrative, query,
|
|
493
|
+
expect(code).toEqual(`import { describe, experience, it, narrative, query, specs } from '@auto-engineer/narrative';
|
|
478
494
|
narrative('Test Flow with IDs', 'FLOW-123', () => {
|
|
479
495
|
experience('Homepage', 'SLICE-ABC').client(() => {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
496
|
+
describe('Homepage specs', () => {
|
|
497
|
+
it('show welcome message');
|
|
498
|
+
it('display navigation');
|
|
483
499
|
});
|
|
484
500
|
});
|
|
485
501
|
query('view products', 'SLICE-XYZ')
|
|
486
502
|
.client(() => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
503
|
+
describe('Product list specs', () => {
|
|
504
|
+
it('display all products');
|
|
505
|
+
it('allow filtering');
|
|
490
506
|
});
|
|
491
507
|
})
|
|
492
508
|
.server(() => {
|
|
@@ -508,7 +524,7 @@ narrative('Test Flow with IDs', 'FLOW-123', () => {
|
|
|
508
524
|
id: 'SLICE-789',
|
|
509
525
|
type: 'command',
|
|
510
526
|
client: {
|
|
511
|
-
|
|
527
|
+
specs: [],
|
|
512
528
|
},
|
|
513
529
|
server: {
|
|
514
530
|
description: 'Command processing server',
|
|
@@ -664,34 +680,36 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
|
|
|
664
680
|
narratives: [
|
|
665
681
|
{
|
|
666
682
|
name: 'Questionnaires',
|
|
667
|
-
id: '
|
|
683
|
+
id: 'Q9m2Kp4Lx',
|
|
668
684
|
slices: [
|
|
669
685
|
{
|
|
670
686
|
name: 'Homepage',
|
|
671
|
-
id: '
|
|
687
|
+
id: 'H1a4Bn6Cy',
|
|
672
688
|
type: 'experience',
|
|
673
689
|
client: {
|
|
674
|
-
specs:
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
690
|
+
specs: [
|
|
691
|
+
{ type: 'it', title: 'show a hero section with a welcome message' },
|
|
692
|
+
{ type: 'it', title: 'allow user to start the questionnaire' },
|
|
693
|
+
],
|
|
678
694
|
},
|
|
679
695
|
},
|
|
680
696
|
{
|
|
681
697
|
name: 'views the questionnaire',
|
|
682
|
-
id: '
|
|
698
|
+
id: 'V7n8Rq5M',
|
|
683
699
|
type: 'query',
|
|
684
700
|
client: {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
701
|
+
specs: [
|
|
702
|
+
{
|
|
703
|
+
type: 'describe',
|
|
704
|
+
title: 'Questionnaire Progress',
|
|
705
|
+
children: [
|
|
706
|
+
{ type: 'it', title: 'focus on the current question based on the progress state' },
|
|
707
|
+
{ type: 'it', title: 'display the list of answered questions' },
|
|
708
|
+
{ type: 'it', title: 'display the list of remaining questions' },
|
|
709
|
+
{ type: 'it', title: 'show a progress indicator that is always visible as the user scrolls' },
|
|
710
|
+
],
|
|
711
|
+
},
|
|
712
|
+
],
|
|
695
713
|
},
|
|
696
714
|
request: '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}',
|
|
697
715
|
server: {
|
|
@@ -713,7 +731,7 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
|
|
|
713
731
|
name: '',
|
|
714
732
|
rules: [
|
|
715
733
|
{
|
|
716
|
-
id: '
|
|
734
|
+
id: 'r1A3Bp9W',
|
|
717
735
|
description: 'questionnaires show current progress',
|
|
718
736
|
examples: [
|
|
719
737
|
{
|
|
@@ -878,13 +896,14 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
|
|
|
878
896
|
const code = await modelToNarrative(questionnairesModel);
|
|
879
897
|
expect(code).toEqual(`import {
|
|
880
898
|
data,
|
|
899
|
+
describe,
|
|
881
900
|
example,
|
|
882
901
|
experience,
|
|
883
902
|
gql,
|
|
903
|
+
it,
|
|
884
904
|
narrative,
|
|
885
905
|
query,
|
|
886
906
|
rule,
|
|
887
|
-
should,
|
|
888
907
|
source,
|
|
889
908
|
specs,
|
|
890
909
|
} from '@auto-engineer/narrative';
|
|
@@ -922,20 +941,18 @@ type QuestionnaireProgress = State<
|
|
|
922
941
|
}[];
|
|
923
942
|
}
|
|
924
943
|
>;
|
|
925
|
-
narrative('Questionnaires', '
|
|
926
|
-
experience('Homepage', '
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
should('allow user to start the questionnaire');
|
|
930
|
-
});
|
|
944
|
+
narrative('Questionnaires', 'Q9m2Kp4Lx', () => {
|
|
945
|
+
experience('Homepage', 'H1a4Bn6Cy').client(() => {
|
|
946
|
+
it('show a hero section with a welcome message');
|
|
947
|
+
it('allow user to start the questionnaire');
|
|
931
948
|
});
|
|
932
|
-
query('views the questionnaire', '
|
|
949
|
+
query('views the questionnaire', 'V7n8Rq5M')
|
|
933
950
|
.client(() => {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
951
|
+
describe('Questionnaire Progress', () => {
|
|
952
|
+
it('focus on the current question based on the progress state');
|
|
953
|
+
it('display the list of answered questions');
|
|
954
|
+
it('display the list of remaining questions');
|
|
955
|
+
it('show a progress indicator that is always visible as the user scrolls');
|
|
939
956
|
});
|
|
940
957
|
})
|
|
941
958
|
.request(
|
|
@@ -956,7 +973,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
|
|
|
956
973
|
.server(() => {
|
|
957
974
|
data([source().state('QuestionnaireProgress').fromProjection('Questionnaires', 'questionnaire-participantId')]);
|
|
958
975
|
specs(() => {
|
|
959
|
-
rule('questionnaires show current progress', '
|
|
976
|
+
rule('questionnaires show current progress', 'r1A3Bp9W', () => {
|
|
960
977
|
example('a question has already been answered')
|
|
961
978
|
.given<QuestionnaireLinkSent>({
|
|
962
979
|
questionnaireId: 'q-001',
|
|
@@ -998,7 +1015,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
|
|
|
998
1015
|
id: 'TEST-SLICE',
|
|
999
1016
|
type: 'query',
|
|
1000
1017
|
client: {
|
|
1001
|
-
|
|
1018
|
+
specs: [],
|
|
1002
1019
|
},
|
|
1003
1020
|
server: {
|
|
1004
1021
|
description: 'Test server for duplicate rules',
|
|
@@ -1006,7 +1023,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
|
|
|
1006
1023
|
name: 'Test Rules',
|
|
1007
1024
|
rules: [
|
|
1008
1025
|
{
|
|
1009
|
-
id: '
|
|
1026
|
+
id: 'r1A3Bp9W',
|
|
1010
1027
|
description: 'questionnaires show current progress',
|
|
1011
1028
|
examples: [
|
|
1012
1029
|
{
|
|
@@ -1134,7 +1151,7 @@ type QuestionnaireProgress = State<
|
|
|
1134
1151
|
narrative('Test Flow', 'TEST-FLOW', () => {
|
|
1135
1152
|
query('test slice', 'TEST-SLICE').server(() => {
|
|
1136
1153
|
specs('Test Rules', () => {
|
|
1137
|
-
rule('questionnaires show current progress', '
|
|
1154
|
+
rule('questionnaires show current progress', 'r1A3Bp9W', () => {
|
|
1138
1155
|
example('a question has already been answered')
|
|
1139
1156
|
.given<QuestionnaireLinkSent>({ questionnaireId: 'q-001', participantId: 'participant-abc' })
|
|
1140
1157
|
.when<QuestionAnswered>({ questionnaireId: 'q-001', questionId: 'q1', answer: 'Yes' })
|
|
@@ -1162,7 +1179,7 @@ narrative('Test Flow', 'TEST-FLOW', () => {
|
|
|
1162
1179
|
id: 'MULTI-SLICE',
|
|
1163
1180
|
type: 'query',
|
|
1164
1181
|
client: {
|
|
1165
|
-
|
|
1182
|
+
specs: [],
|
|
1166
1183
|
},
|
|
1167
1184
|
server: {
|
|
1168
1185
|
description: 'Multi given server rules',
|
|
@@ -1170,7 +1187,7 @@ narrative('Test Flow', 'TEST-FLOW', () => {
|
|
|
1170
1187
|
name: 'Multi Given Rules',
|
|
1171
1188
|
rules: [
|
|
1172
1189
|
{
|
|
1173
|
-
id: '
|
|
1190
|
+
id: 'MultiGiven',
|
|
1174
1191
|
description: 'all questions have been answered',
|
|
1175
1192
|
examples: [
|
|
1176
1193
|
{
|
|
@@ -1346,7 +1363,7 @@ type QuestionnaireProgress = State<
|
|
|
1346
1363
|
narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
|
|
1347
1364
|
query('multi given slice', 'MULTI-SLICE').server(() => {
|
|
1348
1365
|
specs('Multi Given Rules', () => {
|
|
1349
|
-
rule('all questions have been answered', '
|
|
1366
|
+
rule('all questions have been answered', 'MultiGiven', () => {
|
|
1350
1367
|
example('questionnaire with multiple events')
|
|
1351
1368
|
.given<QuestionnaireConfig>({ questionnaireId: 'q-001', numberOfQuestions: 3 })
|
|
1352
1369
|
.and<QuestionnaireLinkSent>({
|
|
@@ -1406,7 +1423,7 @@ narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
|
|
|
1406
1423
|
id: 'REF-SLICE',
|
|
1407
1424
|
type: 'query',
|
|
1408
1425
|
client: {
|
|
1409
|
-
|
|
1426
|
+
specs: [],
|
|
1410
1427
|
},
|
|
1411
1428
|
server: {
|
|
1412
1429
|
description: 'Server for referenced states',
|
|
@@ -1438,7 +1455,7 @@ narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
|
|
|
1438
1455
|
name: 'Database State Rules',
|
|
1439
1456
|
rules: [
|
|
1440
1457
|
{
|
|
1441
|
-
id: '
|
|
1458
|
+
id: 'RefState',
|
|
1442
1459
|
description: 'questionnaire config is available when referenced',
|
|
1443
1460
|
examples: [
|
|
1444
1461
|
{
|
|
@@ -1531,7 +1548,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
|
|
|
1531
1548
|
source().state('QuestionnaireConfig').fromDatabase('ConfigStore', { questionnaireId: '$questionnaireId' }),
|
|
1532
1549
|
]);
|
|
1533
1550
|
specs('Database State Rules', () => {
|
|
1534
|
-
rule('questionnaire config is available when referenced', '
|
|
1551
|
+
rule('questionnaire config is available when referenced', 'RefState', () => {
|
|
1535
1552
|
example('config from database is accessible')
|
|
1536
1553
|
.given<QuestionnaireConfig>({
|
|
1537
1554
|
questionnaireId: 'q-001',
|
|
@@ -1564,7 +1581,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
|
|
|
1564
1581
|
id: 'DATE-SLICE',
|
|
1565
1582
|
type: 'query',
|
|
1566
1583
|
client: {
|
|
1567
|
-
|
|
1584
|
+
specs: [],
|
|
1568
1585
|
},
|
|
1569
1586
|
server: {
|
|
1570
1587
|
description: 'Date server with Date fields',
|
|
@@ -1572,7 +1589,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
|
|
|
1572
1589
|
name: 'Date Field Rules',
|
|
1573
1590
|
rules: [
|
|
1574
1591
|
{
|
|
1575
|
-
id: '
|
|
1592
|
+
id: 'DateRule',
|
|
1576
1593
|
description: 'handles Date fields correctly',
|
|
1577
1594
|
examples: [
|
|
1578
1595
|
{
|
|
@@ -1679,7 +1696,7 @@ type ProcessState = State<
|
|
|
1679
1696
|
narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
1680
1697
|
query('date handling slice', 'DATE-SLICE').server(() => {
|
|
1681
1698
|
specs('Date Field Rules', () => {
|
|
1682
|
-
rule('handles Date fields correctly', '
|
|
1699
|
+
rule('handles Date fields correctly', 'DateRule', () => {
|
|
1683
1700
|
example('event with Date fields')
|
|
1684
1701
|
.given<TimestampedEvent>({
|
|
1685
1702
|
id: 'event-123',
|
|
@@ -1710,13 +1727,10 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1710
1727
|
slices: [
|
|
1711
1728
|
{
|
|
1712
1729
|
name: 'Active Surveys Summary',
|
|
1713
|
-
id: '
|
|
1730
|
+
id: 'aifPcU3hw',
|
|
1714
1731
|
type: 'experience',
|
|
1715
1732
|
client: {
|
|
1716
|
-
specs: {
|
|
1717
|
-
name: '',
|
|
1718
|
-
rules: ['show active surveys summary'],
|
|
1719
|
-
},
|
|
1733
|
+
specs: [{ type: 'it', title: 'show active surveys summary' }],
|
|
1720
1734
|
},
|
|
1721
1735
|
},
|
|
1722
1736
|
],
|
|
@@ -1727,13 +1741,10 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1727
1741
|
slices: [
|
|
1728
1742
|
{
|
|
1729
1743
|
name: 'Create Survey Form',
|
|
1730
|
-
id: '
|
|
1744
|
+
id: 'MPviTMrQC',
|
|
1731
1745
|
type: 'experience',
|
|
1732
1746
|
client: {
|
|
1733
|
-
specs: {
|
|
1734
|
-
name: '',
|
|
1735
|
-
rules: ['allow entering survey title'],
|
|
1736
|
-
},
|
|
1747
|
+
specs: [{ type: 'it', title: 'allow entering survey title' }],
|
|
1737
1748
|
},
|
|
1738
1749
|
},
|
|
1739
1750
|
],
|
|
@@ -1744,13 +1755,10 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1744
1755
|
slices: [
|
|
1745
1756
|
{
|
|
1746
1757
|
name: 'Response Rate Charts',
|
|
1747
|
-
id: '
|
|
1758
|
+
id: 'eME978Euk',
|
|
1748
1759
|
type: 'experience',
|
|
1749
1760
|
client: {
|
|
1750
|
-
specs: {
|
|
1751
|
-
name: '',
|
|
1752
|
-
rules: ['show daily response rate charts'],
|
|
1753
|
-
},
|
|
1761
|
+
specs: [{ type: 'it', title: 'show daily response rate charts' }],
|
|
1754
1762
|
},
|
|
1755
1763
|
},
|
|
1756
1764
|
],
|
|
@@ -1760,26 +1768,20 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
|
|
|
1760
1768
|
integrations: [],
|
|
1761
1769
|
};
|
|
1762
1770
|
const code = await modelToNarrative(modelWithMultipleFlowsSameSource);
|
|
1763
|
-
expect(code).toEqual(`import { experience,
|
|
1771
|
+
expect(code).toEqual(`import { experience, it, narrative } from '@auto-engineer/narrative';
|
|
1764
1772
|
narrative('Home Screen', () => {
|
|
1765
|
-
experience('Active Surveys Summary', '
|
|
1766
|
-
|
|
1767
|
-
should('show active surveys summary');
|
|
1768
|
-
});
|
|
1773
|
+
experience('Active Surveys Summary', 'aifPcU3hw').client(() => {
|
|
1774
|
+
it('show active surveys summary');
|
|
1769
1775
|
});
|
|
1770
1776
|
});
|
|
1771
1777
|
narrative('Create Survey', () => {
|
|
1772
|
-
experience('Create Survey Form', '
|
|
1773
|
-
|
|
1774
|
-
should('allow entering survey title');
|
|
1775
|
-
});
|
|
1778
|
+
experience('Create Survey Form', 'MPviTMrQC').client(() => {
|
|
1779
|
+
it('allow entering survey title');
|
|
1776
1780
|
});
|
|
1777
1781
|
});
|
|
1778
1782
|
narrative('Response Analytics', () => {
|
|
1779
|
-
experience('Response Rate Charts', '
|
|
1780
|
-
|
|
1781
|
-
should('show daily response rate charts');
|
|
1782
|
-
});
|
|
1783
|
+
experience('Response Rate Charts', 'eME978Euk').client(() => {
|
|
1784
|
+
it('show daily response rate charts');
|
|
1783
1785
|
});
|
|
1784
1786
|
});
|
|
1785
1787
|
`);
|
|
@@ -1797,7 +1799,7 @@ narrative('Response Analytics', () => {
|
|
|
1797
1799
|
id: 'SUMMARY-001',
|
|
1798
1800
|
type: 'query',
|
|
1799
1801
|
client: {
|
|
1800
|
-
|
|
1802
|
+
specs: [],
|
|
1801
1803
|
},
|
|
1802
1804
|
server: {
|
|
1803
1805
|
description: 'Summary calculation server',
|
|
@@ -2006,7 +2008,7 @@ narrative('Todo List Summary', 'TODO-001', () => {
|
|
|
2006
2008
|
id: 'SUMMARY-SLICE',
|
|
2007
2009
|
type: 'query',
|
|
2008
2010
|
client: {
|
|
2009
|
-
|
|
2011
|
+
specs: [],
|
|
2010
2012
|
},
|
|
2011
2013
|
server: {
|
|
2012
2014
|
description: 'Summary server',
|
|
@@ -2076,7 +2078,7 @@ narrative('Todo Summary Flow', 'TODO-SUMMARY', () => {
|
|
|
2076
2078
|
id: 'TODO-SLICE',
|
|
2077
2079
|
type: 'query',
|
|
2078
2080
|
client: {
|
|
2079
|
-
|
|
2081
|
+
specs: [],
|
|
2080
2082
|
},
|
|
2081
2083
|
server: {
|
|
2082
2084
|
description: 'Todo server',
|
|
@@ -2146,7 +2148,7 @@ narrative('Todo Flow', 'TODO-FLOW', () => {
|
|
|
2146
2148
|
id: 'USER-PROJECT-SLICE',
|
|
2147
2149
|
type: 'query',
|
|
2148
2150
|
client: {
|
|
2149
|
-
|
|
2151
|
+
specs: [],
|
|
2150
2152
|
},
|
|
2151
2153
|
server: {
|
|
2152
2154
|
description: 'User project server',
|
|
@@ -2218,7 +2220,7 @@ narrative('User Project Flow', 'USER-PROJECT-FLOW', () => {
|
|
|
2218
2220
|
id: 'SUMMARY-SLICE',
|
|
2219
2221
|
type: 'query',
|
|
2220
2222
|
client: {
|
|
2221
|
-
|
|
2223
|
+
specs: [],
|
|
2222
2224
|
},
|
|
2223
2225
|
server: {
|
|
2224
2226
|
description: 'Summary server',
|
|
@@ -2246,7 +2248,7 @@ narrative('User Project Flow', 'USER-PROJECT-FLOW', () => {
|
|
|
2246
2248
|
id: 'TODO-SLICE',
|
|
2247
2249
|
type: 'query',
|
|
2248
2250
|
client: {
|
|
2249
|
-
|
|
2251
|
+
specs: [],
|
|
2250
2252
|
},
|
|
2251
2253
|
server: {
|
|
2252
2254
|
description: 'Todo server',
|
|
@@ -2274,7 +2276,7 @@ narrative('User Project Flow', 'USER-PROJECT-FLOW', () => {
|
|
|
2274
2276
|
id: 'USER-PROJECT-SLICE',
|
|
2275
2277
|
type: 'query',
|
|
2276
2278
|
client: {
|
|
2277
|
-
|
|
2279
|
+
specs: [],
|
|
2278
2280
|
},
|
|
2279
2281
|
server: {
|
|
2280
2282
|
description: 'User project server',
|