@coorpacademy/app-review 0.2.7 → 0.2.9-alpha.5
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/es/actions/api/fetch-rank.d.ts +32 -0
- package/es/actions/api/fetch-rank.js +30 -0
- package/es/actions/api/test/fetch-correction.test.js +2 -1
- package/es/actions/api/test/fetch-rank.test.d.ts +1 -0
- package/es/actions/api/test/fetch-rank.test.js +100 -0
- package/es/actions/api/test/fetch-skills.test.js +2 -1
- package/es/actions/api/test/fetch-slide.test.js +2 -1
- package/es/actions/api/test/post-answer.test.js +2 -1
- package/es/actions/api/test/post-progression.test.js +2 -1
- package/es/actions/data/test/token.test.js +2 -1
- package/es/actions/ui/test/answers.test.js +2 -1
- package/es/actions/ui/test/slides.test.js +2 -1
- package/es/reducers/data/corrections.d.ts +1 -1
- package/es/reducers/data/index.d.ts +4 -1
- package/es/reducers/data/index.js +2 -1
- package/es/reducers/data/rank.d.ts +7 -0
- package/es/reducers/data/rank.js +36 -0
- package/es/reducers/data/test/rank.test.d.ts +1 -0
- package/es/reducers/data/test/rank.test.js +59 -0
- package/es/reducers/index.d.ts +4 -3
- package/es/reducers/ui/slide.d.ts +1 -0
- package/es/reducers/ui/slide.js +1 -1
- package/es/services/index.js +2 -0
- package/es/test/util/services.mock.d.ts +1 -0
- package/es/test/util/services.mock.js +21 -1
- package/es/types/common.d.ts +1 -0
- package/es/views/skills/test/skills.test.js +4 -2
- package/es/views/slides/index.d.ts +21 -19
- package/es/views/slides/index.js +29 -3
- package/es/views/slides/test/fixtures/qcm-graphic.js +190 -28
- package/es/views/slides/test/index.test.js +200 -19
- package/es/views/slides/test/slide.free-text.on-change.test.js +4 -1
- package/es/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
- package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
- package/es/views/slides/test/slide.qcm.on-click.test.js +4 -1
- package/es/views/slides/test/slide.slider.on-change.test.js +4 -1
- package/es/views/slides/test/slide.template.on-change.test.js +6 -1
- package/lib/actions/api/fetch-rank.d.ts +32 -0
- package/lib/actions/api/fetch-rank.js +32 -0
- package/lib/actions/api/test/fetch-correction.test.js +2 -1
- package/lib/actions/api/test/fetch-rank.test.d.ts +1 -0
- package/lib/actions/api/test/fetch-rank.test.js +171 -0
- package/lib/actions/api/test/fetch-skills.test.js +2 -1
- package/lib/actions/api/test/fetch-slide.test.js +2 -1
- package/lib/actions/api/test/post-answer.test.js +2 -1
- package/lib/actions/api/test/post-progression.test.js +2 -1
- package/lib/actions/data/test/token.test.js +2 -1
- package/lib/actions/ui/test/answers.test.js +2 -1
- package/lib/actions/ui/test/slides.test.js +2 -1
- package/lib/reducers/data/corrections.d.ts +1 -1
- package/lib/reducers/data/index.d.ts +4 -1
- package/lib/reducers/data/index.js +2 -1
- package/lib/reducers/data/rank.d.ts +7 -0
- package/lib/reducers/data/rank.js +37 -0
- package/lib/reducers/data/test/rank.test.d.ts +1 -0
- package/lib/reducers/data/test/rank.test.js +59 -0
- package/lib/reducers/index.d.ts +4 -3
- package/lib/reducers/ui/slide.d.ts +1 -0
- package/lib/reducers/ui/slide.js +1 -1
- package/lib/services/index.js +2 -0
- package/lib/test/util/services.mock.d.ts +1 -0
- package/lib/test/util/services.mock.js +12 -1
- package/lib/types/common.d.ts +1 -0
- package/lib/views/skills/test/skills.test.js +4 -2
- package/lib/views/slides/index.d.ts +21 -19
- package/lib/views/slides/index.js +29 -3
- package/lib/views/slides/test/fixtures/qcm-graphic.js +190 -28
- package/lib/views/slides/test/index.test.js +211 -22
- package/lib/views/slides/test/slide.free-text.on-change.test.js +4 -1
- package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
- package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
- package/lib/views/slides/test/slide.qcm.on-click.test.js +4 -1
- package/lib/views/slides/test/slide.slider.on-change.test.js +4 -1
- package/lib/views/slides/test/slide.template.on-change.test.js +6 -1
- package/package.json +4 -4
- package/src/actions/api/fetch-rank.ts +84 -0
- package/src/actions/api/test/fetch-correction.test.ts +2 -1
- package/src/actions/api/test/fetch-rank.test.ts +130 -0
- package/src/actions/api/test/fetch-skills.test.ts +2 -1
- package/src/actions/api/test/fetch-slide.test.ts +2 -1
- package/src/actions/api/test/post-answer.test.ts +2 -1
- package/src/actions/api/test/post-progression.test.ts +2 -1
- package/src/actions/data/test/token.test.ts +2 -1
- package/src/actions/ui/test/answers.test.ts +2 -1
- package/src/actions/ui/test/slides.test.ts +2 -1
- package/src/reducers/data/corrections.ts +1 -1
- package/src/reducers/data/index.ts +3 -1
- package/src/reducers/data/rank.ts +60 -0
- package/src/reducers/data/test/rank.test.ts +78 -0
- package/src/reducers/index.ts +2 -2
- package/src/reducers/ui/slide.ts +2 -1
- package/src/services/index.ts +2 -0
- package/src/test/util/services.mock.ts +23 -1
- package/src/types/common.ts +1 -0
- package/src/views/skills/test/skills.test.ts +4 -2
- package/src/views/slides/index.ts +65 -22
- package/src/views/slides/test/fixtures/qcm-graphic.ts +196 -29
- package/src/views/slides/test/index.test.ts +210 -21
- package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -1
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -1
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +6 -4
- package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -1
- package/src/views/slides/test/slide.slider.on-change.test.ts +4 -1
- package/src/views/slides/test/slide.template.on-change.test.ts +6 -1
|
@@ -2,13 +2,39 @@ import test from 'ava';
|
|
|
2
2
|
import identity from 'lodash/fp/identity';
|
|
3
3
|
import omit from 'lodash/fp/omit';
|
|
4
4
|
import set from 'lodash/fp/set';
|
|
5
|
-
import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide } from '../../../test/util/services.mock';
|
|
5
|
+
import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide, getChoicesCorrection, incorrectFreeTextPostAnswerResponse } from '../../../test/util/services.mock';
|
|
6
6
|
import { mapStateToSlidesProps } from '..';
|
|
7
7
|
import { freeTextSlide } from './fixtures/free-text';
|
|
8
8
|
import { qcmGraphicSlide } from './fixtures/qcm-graphic';
|
|
9
9
|
import { templateSlide } from './fixtures/template';
|
|
10
10
|
import { qcmSlide } from './fixtures/qcm';
|
|
11
11
|
import { sliderSlide } from './fixtures/slider';
|
|
12
|
+
const popinPropsRightAnswer = {
|
|
13
|
+
resultLabel: '_right',
|
|
14
|
+
information: {
|
|
15
|
+
label: '_klf',
|
|
16
|
+
message: 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
|
|
17
|
+
},
|
|
18
|
+
klf: undefined,
|
|
19
|
+
next: {
|
|
20
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
21
|
+
label: '_correctionNextLabel'
|
|
22
|
+
},
|
|
23
|
+
type: 'right'
|
|
24
|
+
};
|
|
25
|
+
const popinPropsWrongAnswer = {
|
|
26
|
+
...popinPropsRightAnswer,
|
|
27
|
+
klf: {
|
|
28
|
+
label: '_klf',
|
|
29
|
+
tooltip: 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
|
|
30
|
+
},
|
|
31
|
+
type: 'wrong',
|
|
32
|
+
resultLabel: '_wrong',
|
|
33
|
+
information: {
|
|
34
|
+
label: '_correctAnswer',
|
|
35
|
+
message: 'Benchmark'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
12
38
|
test('should create initial props when fetched slide is not still received', t => {
|
|
13
39
|
// SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
|
|
14
40
|
const state = {
|
|
@@ -19,7 +45,8 @@ test('should create initial props when fetched slide is not still received', t =
|
|
|
19
45
|
sli_N1XACJobn: null
|
|
20
46
|
},
|
|
21
47
|
token: '1234',
|
|
22
|
-
corrections: {}
|
|
48
|
+
corrections: {},
|
|
49
|
+
rank: {}
|
|
23
50
|
},
|
|
24
51
|
ui: {
|
|
25
52
|
currentSlideRef: '',
|
|
@@ -107,7 +134,8 @@ test('should create props when first slide is on the state', t => {
|
|
|
107
134
|
sli_VJYjJnJhg: freeTextSlide
|
|
108
135
|
},
|
|
109
136
|
token: '1234',
|
|
110
|
-
corrections: {}
|
|
137
|
+
corrections: {},
|
|
138
|
+
rank: {}
|
|
111
139
|
},
|
|
112
140
|
ui: {
|
|
113
141
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -158,6 +186,8 @@ test('should create props when first slide is on the state', t => {
|
|
|
158
186
|
endReview: false
|
|
159
187
|
});
|
|
160
188
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
189
|
+
animateCorrectionPopin: false,
|
|
190
|
+
showCorrectionPopin: false,
|
|
161
191
|
hidden: false,
|
|
162
192
|
position: 0,
|
|
163
193
|
loading: false,
|
|
@@ -206,7 +236,8 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
206
236
|
sli_VJYjJnJhg: freeTextSlide
|
|
207
237
|
},
|
|
208
238
|
token: '1234',
|
|
209
|
-
corrections: {}
|
|
239
|
+
corrections: {},
|
|
240
|
+
rank: {}
|
|
210
241
|
},
|
|
211
242
|
ui: {
|
|
212
243
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -257,6 +288,8 @@ test('should create props when slide is on the state and user has selected answe
|
|
|
257
288
|
endReview: false
|
|
258
289
|
});
|
|
259
290
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
291
|
+
animateCorrectionPopin: false,
|
|
292
|
+
showCorrectionPopin: false,
|
|
260
293
|
hidden: false,
|
|
261
294
|
position: 0,
|
|
262
295
|
loading: false,
|
|
@@ -306,7 +339,8 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
306
339
|
sli_VkSQroQnx: null
|
|
307
340
|
},
|
|
308
341
|
token: '1234',
|
|
309
|
-
corrections: {}
|
|
342
|
+
corrections: {},
|
|
343
|
+
rank: {}
|
|
310
344
|
},
|
|
311
345
|
ui: {
|
|
312
346
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -357,6 +391,8 @@ test('should verify props when first slide was answered correctly and next slide
|
|
|
357
391
|
endReview: false
|
|
358
392
|
});
|
|
359
393
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
394
|
+
animateCorrectionPopin: false,
|
|
395
|
+
showCorrectionPopin: false,
|
|
360
396
|
hidden: false,
|
|
361
397
|
position: 0,
|
|
362
398
|
loading: false,
|
|
@@ -406,7 +442,8 @@ test('should verify props when first slide was answered with error and next slid
|
|
|
406
442
|
sli_VkSQroQnx: null
|
|
407
443
|
},
|
|
408
444
|
token: '1234',
|
|
409
|
-
corrections: {}
|
|
445
|
+
corrections: {},
|
|
446
|
+
rank: {}
|
|
410
447
|
},
|
|
411
448
|
ui: {
|
|
412
449
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
@@ -453,7 +490,7 @@ test('should verify props when first slide was answered with error and next slid
|
|
|
453
490
|
]
|
|
454
491
|
});
|
|
455
492
|
});
|
|
456
|
-
test('should verify props when first slide was answered
|
|
493
|
+
test('should verify props when first slide was answered, next slide is fetched & correction is fetched', t => {
|
|
457
494
|
// Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
|
|
458
495
|
const state = {
|
|
459
496
|
data: {
|
|
@@ -464,14 +501,19 @@ test('should verify props when first slide was answered and next slide is fecthe
|
|
|
464
501
|
sli_VkSQroQnx: qcmGraphicSlide
|
|
465
502
|
},
|
|
466
503
|
token: '1234',
|
|
467
|
-
corrections: {
|
|
504
|
+
corrections: {
|
|
505
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id)
|
|
506
|
+
},
|
|
507
|
+
rank: {}
|
|
468
508
|
},
|
|
469
509
|
ui: {
|
|
470
510
|
currentSlideRef: 'sli_VJYjJnJhg',
|
|
471
511
|
navigation: ['loader', 'slides'],
|
|
472
512
|
answers: ['My value'],
|
|
473
513
|
slide: {
|
|
474
|
-
validateButton: false
|
|
514
|
+
validateButton: false,
|
|
515
|
+
animateCorrectionPopin: true,
|
|
516
|
+
showCorrectionPopin: true
|
|
475
517
|
}
|
|
476
518
|
}
|
|
477
519
|
};
|
|
@@ -510,11 +552,13 @@ test('should verify props when first slide was answered and next slide is fecthe
|
|
|
510
552
|
}
|
|
511
553
|
]
|
|
512
554
|
});
|
|
513
|
-
t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
|
|
514
|
-
correctionPopinProps:
|
|
555
|
+
t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
|
|
556
|
+
correctionPopinProps: popinPropsRightAnswer,
|
|
515
557
|
endReview: false
|
|
516
558
|
});
|
|
517
559
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
560
|
+
animateCorrectionPopin: true,
|
|
561
|
+
showCorrectionPopin: true,
|
|
518
562
|
hidden: false,
|
|
519
563
|
position: 0,
|
|
520
564
|
loading: false,
|
|
@@ -530,11 +574,13 @@ test('should verify props when first slide was answered and next slide is fecthe
|
|
|
530
574
|
}
|
|
531
575
|
});
|
|
532
576
|
t.deepEqual(omit('answerUI', props.stack.slides['1']), {
|
|
577
|
+
animateCorrectionPopin: false,
|
|
578
|
+
showCorrectionPopin: false,
|
|
533
579
|
hidden: false,
|
|
534
580
|
position: 1,
|
|
535
581
|
loading: false,
|
|
536
582
|
parentContentTitle: 'From "Developing the review app" course',
|
|
537
|
-
questionText: '
|
|
583
|
+
questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
|
|
538
584
|
});
|
|
539
585
|
t.is(props.stack.validateButton.disabled, true);
|
|
540
586
|
t.deepEqual(omit(['0', '1'], props.stack.slides), {
|
|
@@ -555,7 +601,118 @@ test('should verify props when first slide was answered and next slide is fecthe
|
|
|
555
601
|
}
|
|
556
602
|
});
|
|
557
603
|
});
|
|
558
|
-
test('should verify props when
|
|
604
|
+
test('should verify props when first slide was answered incorrectly, next slide is fetched & correction is fetched', t => {
|
|
605
|
+
// Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
|
|
606
|
+
const state = {
|
|
607
|
+
data: {
|
|
608
|
+
progression: incorrectFreeTextPostAnswerResponse,
|
|
609
|
+
skills: [],
|
|
610
|
+
slides: {
|
|
611
|
+
sli_VJYjJnJhg: freeTextSlide,
|
|
612
|
+
sli_VkSQroQnx: qcmGraphicSlide
|
|
613
|
+
},
|
|
614
|
+
token: '1234',
|
|
615
|
+
corrections: {
|
|
616
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id, true)
|
|
617
|
+
},
|
|
618
|
+
rank: {}
|
|
619
|
+
},
|
|
620
|
+
ui: {
|
|
621
|
+
currentSlideRef: 'sli_VJYjJnJhg',
|
|
622
|
+
navigation: ['loader', 'slides'],
|
|
623
|
+
answers: ['My value'],
|
|
624
|
+
slide: {
|
|
625
|
+
validateButton: false,
|
|
626
|
+
animateCorrectionPopin: true,
|
|
627
|
+
showCorrectionPopin: true
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
const props = mapStateToSlidesProps(state, identity);
|
|
632
|
+
t.is(props.congratsProps, undefined);
|
|
633
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
634
|
+
'aria-label': 'aria-header-wrapper',
|
|
635
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
636
|
+
mode: '__revision_mode',
|
|
637
|
+
skillName: '__agility',
|
|
638
|
+
steps: [
|
|
639
|
+
{
|
|
640
|
+
current: true,
|
|
641
|
+
icon: 'wrong',
|
|
642
|
+
value: '1'
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
current: false,
|
|
646
|
+
icon: 'no-answer',
|
|
647
|
+
value: '2'
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
current: false,
|
|
651
|
+
icon: 'no-answer',
|
|
652
|
+
value: '3'
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
current: false,
|
|
656
|
+
icon: 'no-answer',
|
|
657
|
+
value: '4'
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
current: false,
|
|
661
|
+
icon: 'no-answer',
|
|
662
|
+
value: '5'
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
});
|
|
666
|
+
t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
|
|
667
|
+
correctionPopinProps: popinPropsWrongAnswer,
|
|
668
|
+
endReview: false
|
|
669
|
+
});
|
|
670
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
671
|
+
animateCorrectionPopin: true,
|
|
672
|
+
showCorrectionPopin: true,
|
|
673
|
+
hidden: false,
|
|
674
|
+
position: 0,
|
|
675
|
+
loading: false,
|
|
676
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
677
|
+
questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
|
|
678
|
+
});
|
|
679
|
+
t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
|
|
680
|
+
help: 'Type your answer.',
|
|
681
|
+
model: {
|
|
682
|
+
placeholder: 'Type here',
|
|
683
|
+
type: 'freeText',
|
|
684
|
+
value: 'My value'
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
t.deepEqual(omit('answerUI', props.stack.slides['1']), {
|
|
688
|
+
animateCorrectionPopin: false,
|
|
689
|
+
showCorrectionPopin: false,
|
|
690
|
+
hidden: false,
|
|
691
|
+
position: 1,
|
|
692
|
+
loading: false,
|
|
693
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
694
|
+
questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
|
|
695
|
+
});
|
|
696
|
+
t.is(props.stack.validateButton.disabled, true);
|
|
697
|
+
t.deepEqual(omit(['0', '1'], props.stack.slides), {
|
|
698
|
+
'2': {
|
|
699
|
+
hidden: false,
|
|
700
|
+
position: 2,
|
|
701
|
+
loading: true
|
|
702
|
+
},
|
|
703
|
+
'3': {
|
|
704
|
+
hidden: false,
|
|
705
|
+
position: 3,
|
|
706
|
+
loading: true
|
|
707
|
+
},
|
|
708
|
+
'4': {
|
|
709
|
+
hidden: false,
|
|
710
|
+
position: 4,
|
|
711
|
+
loading: true
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
test('should verify props when currentSlideRef has changed to nextContent of progression after first answered question', t => {
|
|
559
716
|
// state after click on NEXT_SLIDE
|
|
560
717
|
const state = {
|
|
561
718
|
data: {
|
|
@@ -566,7 +723,10 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
|
|
|
566
723
|
sli_VkSQroQnx: qcmGraphicSlide
|
|
567
724
|
},
|
|
568
725
|
token: '1234',
|
|
569
|
-
corrections: {
|
|
726
|
+
corrections: {
|
|
727
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id)
|
|
728
|
+
},
|
|
729
|
+
rank: {}
|
|
570
730
|
},
|
|
571
731
|
ui: {
|
|
572
732
|
currentSlideRef: 'sli_VkSQroQnx',
|
|
@@ -628,7 +788,14 @@ test('should verify props when progression is in success', t => {
|
|
|
628
788
|
[templateSlide.universalRef]: templateSlide
|
|
629
789
|
},
|
|
630
790
|
token: '1234',
|
|
631
|
-
corrections: {
|
|
791
|
+
corrections: {
|
|
792
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
|
|
793
|
+
[qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
|
|
794
|
+
[qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id),
|
|
795
|
+
[sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
|
|
796
|
+
[templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
|
|
797
|
+
},
|
|
798
|
+
rank: {}
|
|
632
799
|
},
|
|
633
800
|
ui: {
|
|
634
801
|
currentSlideRef: templateSlide.universalRef,
|
|
@@ -676,7 +843,7 @@ test('should verify props when progression is in success', t => {
|
|
|
676
843
|
});
|
|
677
844
|
// TODO update test with props.stack validations when NEXT_SLIDE implemented
|
|
678
845
|
});
|
|
679
|
-
test('should verify props when progression has answered a current
|
|
846
|
+
test('should verify props when progression has answered a current pendingSlide', t => {
|
|
680
847
|
// Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains but not yet the currentSlideRef
|
|
681
848
|
const state = {
|
|
682
849
|
data: {
|
|
@@ -690,7 +857,14 @@ test('should verify props when progression has answered a current pendingslide',
|
|
|
690
857
|
[templateSlide.universalRef]: templateSlide
|
|
691
858
|
},
|
|
692
859
|
token: '1234',
|
|
693
|
-
corrections: {
|
|
860
|
+
corrections: {
|
|
861
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
|
|
862
|
+
[qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
|
|
863
|
+
[qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id, true),
|
|
864
|
+
[sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
|
|
865
|
+
[templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
|
|
866
|
+
},
|
|
867
|
+
rank: {}
|
|
694
868
|
},
|
|
695
869
|
ui: {
|
|
696
870
|
currentSlideRef: freeTextSlide.universalRef,
|
|
@@ -736,7 +910,7 @@ test('should verify props when progression has answered a current pendingslide',
|
|
|
736
910
|
]
|
|
737
911
|
});
|
|
738
912
|
});
|
|
739
|
-
test('should verify props when progression has
|
|
913
|
+
test('should verify props when progression still has a pendingSlide', t => {
|
|
740
914
|
// Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains and it is the currentSlideRef
|
|
741
915
|
const state = {
|
|
742
916
|
data: {
|
|
@@ -750,7 +924,14 @@ test('should verify props when progression has still pendingslide', t => {
|
|
|
750
924
|
[templateSlide.universalRef]: templateSlide
|
|
751
925
|
},
|
|
752
926
|
token: '1234',
|
|
753
|
-
corrections: {
|
|
927
|
+
corrections: {
|
|
928
|
+
[freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
|
|
929
|
+
[qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
|
|
930
|
+
[qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id, true),
|
|
931
|
+
[sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
|
|
932
|
+
[templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
|
|
933
|
+
},
|
|
934
|
+
rank: {}
|
|
754
935
|
},
|
|
755
936
|
ui: {
|
|
756
937
|
currentSlideRef: qcmSlide.universalRef,
|
|
@@ -35,7 +35,8 @@ const initialState = {
|
|
|
35
35
|
},
|
|
36
36
|
skills: [],
|
|
37
37
|
token: '1234',
|
|
38
|
-
corrections: {}
|
|
38
|
+
corrections: {},
|
|
39
|
+
rank: {}
|
|
39
40
|
},
|
|
40
41
|
ui: {
|
|
41
42
|
currentSlideRef: freeTextSlide._id,
|
|
@@ -57,6 +58,8 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
|
|
|
57
58
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
58
59
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
59
60
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
61
|
+
animateCorrectionPopin: false,
|
|
62
|
+
showCorrectionPopin: false,
|
|
60
63
|
hidden: false,
|
|
61
64
|
position: 0,
|
|
62
65
|
loading: false,
|
|
@@ -35,7 +35,8 @@ const initialState = {
|
|
|
35
35
|
},
|
|
36
36
|
skills: [],
|
|
37
37
|
token: '1234',
|
|
38
|
-
corrections: {}
|
|
38
|
+
corrections: {},
|
|
39
|
+
rank: {}
|
|
39
40
|
},
|
|
40
41
|
ui: {
|
|
41
42
|
currentSlideRef: qcmDragSlide._id,
|
|
@@ -57,6 +58,8 @@ test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Dra
|
|
|
57
58
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
58
59
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
59
60
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
61
|
+
animateCorrectionPopin: false,
|
|
62
|
+
showCorrectionPopin: false,
|
|
60
63
|
hidden: false,
|
|
61
64
|
position: 0,
|
|
62
65
|
loading: false,
|
|
@@ -35,7 +35,8 @@ const initialState = {
|
|
|
35
35
|
},
|
|
36
36
|
skills: [],
|
|
37
37
|
token: '1234',
|
|
38
|
-
corrections: {}
|
|
38
|
+
corrections: {},
|
|
39
|
+
rank: {}
|
|
39
40
|
},
|
|
40
41
|
ui: {
|
|
41
42
|
currentSlideRef: qcmGraphicSlide._id,
|
|
@@ -51,17 +52,19 @@ test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM
|
|
|
51
52
|
const expectedActions = [
|
|
52
53
|
{
|
|
53
54
|
type: EDIT_QCM_GRAPHIC,
|
|
54
|
-
payload: ['
|
|
55
|
+
payload: ['Le retour d’information']
|
|
55
56
|
}
|
|
56
57
|
];
|
|
57
58
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
58
59
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
59
60
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
61
|
+
animateCorrectionPopin: false,
|
|
62
|
+
showCorrectionPopin: false,
|
|
60
63
|
hidden: false,
|
|
61
64
|
position: 0,
|
|
62
65
|
loading: false,
|
|
63
66
|
parentContentTitle: 'From "Developing the review app" course',
|
|
64
|
-
questionText: '
|
|
67
|
+
questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
|
|
65
68
|
});
|
|
66
69
|
const SlideProps = props.stack.slides['0'].answerUI?.model;
|
|
67
70
|
const onClick = get(['1', 'onClick'], SlideProps.answers);
|
|
@@ -35,7 +35,8 @@ const initialState = {
|
|
|
35
35
|
},
|
|
36
36
|
skills: [],
|
|
37
37
|
token: '1234',
|
|
38
|
-
corrections: {}
|
|
38
|
+
corrections: {},
|
|
39
|
+
rank: {}
|
|
39
40
|
},
|
|
40
41
|
ui: {
|
|
41
42
|
currentSlideRef: qcmSlide._id,
|
|
@@ -59,6 +60,8 @@ test('should dispatch EDIT_QCM action via the property onClick of a QCM slide',
|
|
|
59
60
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
60
61
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
61
62
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
63
|
+
animateCorrectionPopin: false,
|
|
64
|
+
showCorrectionPopin: false,
|
|
62
65
|
hidden: false,
|
|
63
66
|
position: 0,
|
|
64
67
|
loading: false,
|
|
@@ -35,7 +35,8 @@ const initialState = {
|
|
|
35
35
|
},
|
|
36
36
|
skills: [],
|
|
37
37
|
token: '1234',
|
|
38
|
-
corrections: {}
|
|
38
|
+
corrections: {},
|
|
39
|
+
rank: {}
|
|
39
40
|
},
|
|
40
41
|
ui: {
|
|
41
42
|
currentSlideRef: sliderSlide._id,
|
|
@@ -57,6 +58,8 @@ test('should dispatch EDIT_SLIDER action via the property onChange of a Slider s
|
|
|
57
58
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
58
59
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
59
60
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
61
|
+
animateCorrectionPopin: false,
|
|
62
|
+
showCorrectionPopin: false,
|
|
60
63
|
hidden: false,
|
|
61
64
|
position: 0,
|
|
62
65
|
loading: false,
|
|
@@ -35,7 +35,8 @@ const initialState = {
|
|
|
35
35
|
},
|
|
36
36
|
skills: [],
|
|
37
37
|
token: '1234',
|
|
38
|
-
corrections: {}
|
|
38
|
+
corrections: {},
|
|
39
|
+
rank: {}
|
|
39
40
|
},
|
|
40
41
|
ui: {
|
|
41
42
|
currentSlideRef: templateSlide._id,
|
|
@@ -52,6 +53,8 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
|
|
|
52
53
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
53
54
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
54
55
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
56
|
+
animateCorrectionPopin: false,
|
|
57
|
+
showCorrectionPopin: false,
|
|
55
58
|
hidden: false,
|
|
56
59
|
position: 0,
|
|
57
60
|
loading: false,
|
|
@@ -68,6 +71,8 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
|
|
|
68
71
|
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
69
72
|
const props = mapStateToSlidesProps(getState(), dispatch);
|
|
70
73
|
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
74
|
+
animateCorrectionPopin: false,
|
|
75
|
+
showCorrectionPopin: false,
|
|
71
76
|
hidden: false,
|
|
72
77
|
position: 0,
|
|
73
78
|
loading: false,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Dispatch } from 'redux';
|
|
2
|
+
import type { StoreState } from '../../reducers';
|
|
3
|
+
import type { Rank, Services, Options } from '../../types/common';
|
|
4
|
+
export declare const RANK_FETCH_START_REQUEST: "@@rank/FETCH_START_REQUEST";
|
|
5
|
+
export declare const RANK_FETCH_START_SUCCESS: "@@rank/FETCH_START_SUCCESS";
|
|
6
|
+
export declare const RANK_FETCH_START_FAILURE: "@@rank/FETCH_START_FAILURE";
|
|
7
|
+
export declare const RANK_FETCH_END_REQUEST: "@@rank/FETCH_END_REQUEST";
|
|
8
|
+
export declare const RANK_FETCH_END_SUCCESS: "@@rank/FETCH_END_SUCCESS";
|
|
9
|
+
export declare const RANK_FETCH_END_FAILURE: "@@rank/FETCH_END_FAILURE";
|
|
10
|
+
declare type RankFetchStartRequestType = typeof RANK_FETCH_START_REQUEST;
|
|
11
|
+
declare type RankFetchStartSuccessType = typeof RANK_FETCH_START_SUCCESS;
|
|
12
|
+
declare type RankFetchStartFailureType = typeof RANK_FETCH_START_FAILURE;
|
|
13
|
+
declare type RankFetchEndRequestType = typeof RANK_FETCH_END_REQUEST;
|
|
14
|
+
declare type RankFetchEndSuccessType = typeof RANK_FETCH_END_SUCCESS;
|
|
15
|
+
declare type RankFetchEndFailureType = typeof RANK_FETCH_END_FAILURE;
|
|
16
|
+
export declare type RankRequestAction = {
|
|
17
|
+
type: RankFetchStartRequestType | RankFetchEndRequestType;
|
|
18
|
+
};
|
|
19
|
+
export declare type RankSuccessAction = {
|
|
20
|
+
type: RankFetchStartSuccessType | RankFetchEndSuccessType;
|
|
21
|
+
payload: Rank;
|
|
22
|
+
};
|
|
23
|
+
export declare type RankFailureAction = {
|
|
24
|
+
type: RankFetchStartFailureType | RankFetchEndFailureType;
|
|
25
|
+
};
|
|
26
|
+
export declare type RankAction = RankRequestAction | RankSuccessAction | RankFailureAction;
|
|
27
|
+
declare type RankStart = [RankFetchStartRequestType, RankFetchStartSuccessType, RankFetchStartFailureType];
|
|
28
|
+
declare type RankEnd = [RankFetchEndRequestType, RankFetchEndSuccessType, RankFetchEndFailureType];
|
|
29
|
+
export declare const fetchRank: (dispatch: Dispatch, getState: () => StoreState, services: Services, types: RankStart | RankEnd, path?: string) => RankAction;
|
|
30
|
+
export declare const fetchStartRank: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) => RankAction;
|
|
31
|
+
export declare const fetchEndRank: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) => RankAction;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
+
import get from 'lodash/fp/get';
|
|
3
|
+
export var RANK_FETCH_START_REQUEST = '@@rank/FETCH_START_REQUEST';
|
|
4
|
+
export var RANK_FETCH_START_SUCCESS = '@@rank/FETCH_START_SUCCESS';
|
|
5
|
+
export var RANK_FETCH_START_FAILURE = '@@rank/FETCH_START_FAILURE';
|
|
6
|
+
export var RANK_FETCH_END_REQUEST = '@@rank/FETCH_END_REQUEST';
|
|
7
|
+
export var RANK_FETCH_END_SUCCESS = '@@rank/FETCH_END_SUCCESS';
|
|
8
|
+
export var RANK_FETCH_END_FAILURE = '@@rank/FETCH_END_FAILURE';
|
|
9
|
+
export var fetchRank = function (dispatch, getState, services, types, path) {
|
|
10
|
+
var action = buildTask({
|
|
11
|
+
types: types,
|
|
12
|
+
task: function () {
|
|
13
|
+
var state = getState();
|
|
14
|
+
var token = get(['data', 'token'], state);
|
|
15
|
+
return services.fetchRank(token);
|
|
16
|
+
},
|
|
17
|
+
bailout: path ? function (state) { return !!get(path, state); } : undefined
|
|
18
|
+
});
|
|
19
|
+
return dispatch(action);
|
|
20
|
+
};
|
|
21
|
+
export var fetchStartRank = function (dispatch, getState, _a) {
|
|
22
|
+
var services = _a.services;
|
|
23
|
+
return fetchRank(dispatch, getState, services, [RANK_FETCH_START_REQUEST, RANK_FETCH_START_SUCCESS, RANK_FETCH_START_FAILURE], 'data.rank.start');
|
|
24
|
+
};
|
|
25
|
+
export var fetchEndRank = function (dispatch, getState, _a) {
|
|
26
|
+
var services = _a.services;
|
|
27
|
+
return fetchRank(dispatch, getState, services, [
|
|
28
|
+
RANK_FETCH_END_REQUEST,
|
|
29
|
+
RANK_FETCH_END_SUCCESS,
|
|
30
|
+
RANK_FETCH_END_FAILURE
|
|
31
|
+
]);
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|