@coorpacademy/app-review 0.5.3 → 0.5.4

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.
Files changed (78) hide show
  1. package/es/actions/api/fetch-rank.js +5 -1
  2. package/es/actions/ui/quit-popin.d.ts +8 -0
  3. package/es/actions/ui/quit-popin.js +8 -0
  4. package/es/index.d.ts +0 -1
  5. package/es/reducers/data/rank.d.ts +4 -3
  6. package/es/reducers/data/rank.js +9 -18
  7. package/es/reducers/index.d.ts +7 -1
  8. package/es/reducers/ui/index.d.ts +11 -1
  9. package/es/reducers/ui/index.js +5 -1
  10. package/es/reducers/ui/navigation.js +0 -1
  11. package/es/reducers/ui/positions.js +3 -1
  12. package/es/reducers/ui/quit-popin.d.ts +4 -0
  13. package/es/reducers/ui/quit-popin.js +16 -0
  14. package/es/reducers/ui/show-congrats.d.ts +5 -0
  15. package/es/reducers/ui/show-congrats.js +20 -0
  16. package/es/reducers/ui/slide.js +4 -1
  17. package/es/types/common.d.ts +10 -8
  18. package/es/views/slides/index.d.ts +67 -19
  19. package/es/views/slides/index.js +122 -6
  20. package/lib/actions/api/fetch-rank.js +7 -1
  21. package/lib/actions/ui/quit-popin.d.ts +8 -0
  22. package/lib/actions/ui/quit-popin.js +8 -0
  23. package/lib/index.d.ts +0 -1
  24. package/lib/reducers/data/rank.d.ts +4 -3
  25. package/lib/reducers/data/rank.js +9 -18
  26. package/lib/reducers/index.d.ts +7 -1
  27. package/lib/reducers/ui/index.d.ts +11 -1
  28. package/lib/reducers/ui/index.js +5 -1
  29. package/lib/reducers/ui/navigation.js +0 -1
  30. package/lib/reducers/ui/positions.js +3 -1
  31. package/lib/reducers/ui/quit-popin.d.ts +4 -0
  32. package/lib/reducers/ui/quit-popin.js +17 -0
  33. package/lib/reducers/ui/show-congrats.d.ts +5 -0
  34. package/lib/reducers/ui/show-congrats.js +21 -0
  35. package/lib/reducers/ui/slide.js +4 -1
  36. package/lib/types/common.d.ts +10 -8
  37. package/lib/views/slides/index.d.ts +67 -19
  38. package/lib/views/slides/index.js +124 -6
  39. package/package.json +3 -3
  40. package/src/actions/api/fetch-rank.ts +8 -1
  41. package/src/actions/api/test/fetch-correction.test.ts +4 -2
  42. package/src/actions/api/test/fetch-rank.test.ts +17 -8
  43. package/src/actions/api/test/fetch-skills.test.ts +4 -2
  44. package/src/actions/api/test/fetch-slide.test.ts +4 -2
  45. package/src/actions/api/test/post-answer.test.ts +9 -10
  46. package/src/actions/api/test/post-progression.test.ts +4 -2
  47. package/src/actions/data/test/token.test.ts +4 -2
  48. package/src/actions/ui/quit-popin.ts +10 -0
  49. package/src/actions/ui/test/answers.test.ts +4 -2
  50. package/src/actions/ui/test/next-slide.test.ts +5 -2
  51. package/src/actions/ui/test/quit-popin.test.ts +39 -0
  52. package/src/actions/ui/test/slides.test.ts +4 -2
  53. package/src/reducers/data/rank.ts +15 -31
  54. package/src/reducers/data/test/rank.test.ts +33 -52
  55. package/src/reducers/ui/index.ts +7 -1
  56. package/src/reducers/ui/navigation.ts +0 -2
  57. package/src/reducers/ui/positions.ts +3 -1
  58. package/src/reducers/ui/quit-popin.ts +22 -0
  59. package/src/reducers/ui/show-congrats.ts +26 -0
  60. package/src/reducers/ui/slide.ts +4 -2
  61. package/src/reducers/ui/test/positions.test.ts +14 -0
  62. package/src/reducers/ui/test/quit-popin.test.ts +24 -0
  63. package/src/reducers/ui/test/show-congrats.test.ts +40 -0
  64. package/src/reducers/ui/test/slide.test.ts +21 -0
  65. package/src/types/common.ts +12 -8
  66. package/src/views/skills/test/skills.test.ts +8 -4
  67. package/src/views/slides/index.ts +207 -27
  68. package/src/views/slides/test/header.on-click.test.ts +46 -0
  69. package/src/views/slides/test/index.test.ts +335 -25
  70. package/src/views/slides/test/on-quit-popin.on-click.test.ts +65 -0
  71. package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -2
  72. package/src/views/slides/test/slide.next-slide.on-click.test.ts +107 -2
  73. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -2
  74. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +4 -2
  75. package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -2
  76. package/src/views/slides/test/slide.slider.on-change.test.ts +4 -2
  77. package/src/views/slides/test/slide.slider.on-slider-change.test.ts +4 -2
  78. package/src/views/slides/test/slide.template.on-change.test.ts +4 -2
@@ -2,6 +2,7 @@ import test from 'ava';
2
2
  import identity from 'lodash/fp/identity';
3
3
  import type {StoreState} from '../../../reducers';
4
4
  import {
5
+ postAnswerResponses,
5
6
  getChoicesCorrection,
6
7
  incorrectFreeTextPostAnswerResponse,
7
8
  services
@@ -11,6 +12,9 @@ import {createTestStore} from '../../../actions/test/create-test-store';
11
12
  import {NEXT_SLIDE} from '../../../actions/ui/next-slide';
12
13
  import {freeTextSlide} from './fixtures/free-text';
13
14
  import {qcmGraphicSlide} from './fixtures/qcm-graphic';
15
+ import {templateSlide} from './fixtures/template';
16
+ import {qcmSlide} from './fixtures/qcm';
17
+ import {sliderSlide} from './fixtures/slider';
14
18
 
15
19
  test('correction popin actions after click', async t => {
16
20
  const state: StoreState = {
@@ -25,9 +29,10 @@ test('correction popin actions after click', async t => {
25
29
  corrections: {
26
30
  [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id, true)
27
31
  },
28
- rank: {}
32
+ rank: {start: 10, end: Number.NaN}
29
33
  },
30
34
  ui: {
35
+ showCongrats: false,
31
36
  currentSlideRef: 'sli_VJYjJnJhg',
32
37
  navigation: ['loader', 'slides'],
33
38
  answers: {sli_VJYjJnJhg: ['My value']},
@@ -43,7 +48,8 @@ test('correction popin actions after click', async t => {
43
48
  animateCorrectionPopin: false,
44
49
  showCorrectionPopin: false
45
50
  }
46
- }
51
+ },
52
+ showQuitPopin: false
47
53
  }
48
54
  };
49
55
 
@@ -69,3 +75,102 @@ test('correction popin actions after click', async t => {
69
75
  t.deepEqual(updatedState.ui.currentSlideRef, qcmGraphicSlide._id);
70
76
  t.pass();
71
77
  });
78
+
79
+ test('correction popin actions after click when progression is finished', async t => {
80
+ const state: StoreState = {
81
+ data: {
82
+ progression: postAnswerResponses[templateSlide.universalRef],
83
+ skills: [],
84
+ slides: {
85
+ [freeTextSlide.universalRef]: freeTextSlide,
86
+ [qcmGraphicSlide.universalRef]: qcmGraphicSlide,
87
+ [qcmSlide.universalRef]: qcmSlide,
88
+ [sliderSlide.universalRef]: sliderSlide,
89
+ [templateSlide.universalRef]: templateSlide
90
+ },
91
+ token: '1234',
92
+ corrections: {
93
+ [freeTextSlide._id]: getChoicesCorrection(freeTextSlide._id),
94
+ [qcmGraphicSlide.universalRef]: getChoicesCorrection(qcmGraphicSlide._id),
95
+ [qcmSlide.universalRef]: getChoicesCorrection(qcmSlide._id),
96
+ [sliderSlide.universalRef]: getChoicesCorrection(sliderSlide._id),
97
+ [templateSlide.universalRef]: getChoicesCorrection(templateSlide._id)
98
+ },
99
+ rank: {start: 10, end: Number.NaN}
100
+ },
101
+ ui: {
102
+ showCongrats: false,
103
+ showQuitPopin: false,
104
+ currentSlideRef: templateSlide.universalRef,
105
+ navigation: ['loader', 'slides'],
106
+ answers: {
107
+ sli_VJYjJnJhg: ['Benchmark'],
108
+ sli_VkSQroQnx: ['Faux'],
109
+ sli_N1XACJobn: ['Le créateur peut fixer un pourcentage pour chaque transaction future'],
110
+ sli_VkAzsCLKb: ['7'],
111
+ 'sli_N13-hG3kX': ['Leaderboard', 'utilisateurs', 'étoiles']
112
+ },
113
+ positions: [-1, -1, -1, -1, 0],
114
+ slide: {
115
+ sli_VJYjJnJhg: {
116
+ validateButton: false,
117
+ animateCorrectionPopin: false,
118
+ showCorrectionPopin: false,
119
+ animationType: 'unstack'
120
+ },
121
+ sli_VkSQroQnx: {
122
+ validateButton: false,
123
+ animateCorrectionPopin: false,
124
+ showCorrectionPopin: false,
125
+ animationType: 'unstack'
126
+ },
127
+ sli_N1XACJobn: {
128
+ validateButton: false,
129
+ animateCorrectionPopin: false,
130
+ showCorrectionPopin: false,
131
+ animationType: 'unstack'
132
+ },
133
+ sli_VkAzsCLKb: {
134
+ validateButton: false,
135
+ animateCorrectionPopin: false,
136
+ showCorrectionPopin: false,
137
+ animationType: 'unstack'
138
+ },
139
+ 'sli_N13-hG3kX': {
140
+ validateButton: false,
141
+ animateCorrectionPopin: true,
142
+ showCorrectionPopin: true
143
+ }
144
+ }
145
+ }
146
+ };
147
+
148
+ const expectedActions = [
149
+ {
150
+ type: NEXT_SLIDE,
151
+ payload: {
152
+ animationType: 'unstack',
153
+ currentSlideRef: templateSlide.universalRef,
154
+ nextSlideRef: 'successExitNode',
155
+ totalCorrectAnswers: 5,
156
+ answeredSlides: [
157
+ 'sli_VJYjJnJhg',
158
+ 'sli_VkSQroQnx',
159
+ 'sli_N1XACJobn',
160
+ 'sli_VkAzsCLKb',
161
+ 'sli_N13-hG3kX'
162
+ ]
163
+ }
164
+ }
165
+ ];
166
+ const {dispatch, getState} = createTestStore(t, state, services, expectedActions);
167
+ const props = mapStateToSlidesProps(getState(), dispatch, identity);
168
+ t.is(props.congrats, undefined);
169
+ const correctionPopin = props.stack.correctionPopinProps as CorrectionPopinProps;
170
+ await correctionPopin.next.onClick();
171
+
172
+ const updatedState = getState();
173
+ t.deepEqual(updatedState.ui.positions, [-1, -1, -1, -1, 0]);
174
+ t.is(updatedState.ui.currentSlideRef, 'successExitNode');
175
+ t.pass();
176
+ });
@@ -42,9 +42,10 @@ const initialState: StoreState = {
42
42
  skills: [],
43
43
  token: '1234',
44
44
  corrections: {},
45
- rank: {}
45
+ rank: {start: 10, end: Number.NaN}
46
46
  },
47
47
  ui: {
48
+ showCongrats: false,
48
49
  currentSlideRef: qcmDragSlide._id,
49
50
  navigation: ['skills', 'slides'],
50
51
  positions: [0, 1, 2, 3, 4],
@@ -55,7 +56,8 @@ const initialState: StoreState = {
55
56
  animateCorrectionPopin: false,
56
57
  showCorrectionPopin: false
57
58
  }
58
- }
59
+ },
60
+ showQuitPopin: false
59
61
  }
60
62
  };
61
63
 
@@ -42,9 +42,10 @@ const initialState: StoreState = {
42
42
  skills: [],
43
43
  token: '1234',
44
44
  corrections: {},
45
- rank: {}
45
+ rank: {start: 10, end: Number.NaN}
46
46
  },
47
47
  ui: {
48
+ showCongrats: false,
48
49
  currentSlideRef: qcmGraphicSlide._id,
49
50
  navigation: ['skills', 'slides'],
50
51
  positions: [0, 1, 2, 3, 4],
@@ -55,7 +56,8 @@ const initialState: StoreState = {
55
56
  animateCorrectionPopin: false,
56
57
  showCorrectionPopin: false
57
58
  }
58
- }
59
+ },
60
+ showQuitPopin: false
59
61
  }
60
62
  };
61
63
 
@@ -42,9 +42,10 @@ const initialState: StoreState = {
42
42
  skills: [],
43
43
  token: '1234',
44
44
  corrections: {},
45
- rank: {}
45
+ rank: {start: 10, end: Number.NaN}
46
46
  },
47
47
  ui: {
48
+ showCongrats: false,
48
49
  currentSlideRef: qcmSlide._id,
49
50
  navigation: ['skills', 'slides'],
50
51
  positions: [0, 1, 2, 3, 4],
@@ -55,7 +56,8 @@ const initialState: StoreState = {
55
56
  animateCorrectionPopin: false,
56
57
  showCorrectionPopin: false
57
58
  }
58
- }
59
+ },
60
+ showQuitPopin: false
59
61
  }
60
62
  };
61
63
 
@@ -42,9 +42,10 @@ const initialState: StoreState = {
42
42
  skills: [],
43
43
  token: '1234',
44
44
  corrections: {},
45
- rank: {}
45
+ rank: {start: 10, end: Number.NaN}
46
46
  },
47
47
  ui: {
48
+ showCongrats: false,
48
49
  currentSlideRef: sliderSlide._id,
49
50
  navigation: ['skills', 'slides'],
50
51
  positions: [0, 1, 2, 3, 4],
@@ -55,7 +56,8 @@ const initialState: StoreState = {
55
56
  animateCorrectionPopin: false,
56
57
  showCorrectionPopin: false
57
58
  }
58
- }
59
+ },
60
+ showQuitPopin: false
59
61
  }
60
62
  };
61
63
 
@@ -42,9 +42,10 @@ const initialState: StoreState = {
42
42
  skills: [],
43
43
  token: '1234',
44
44
  corrections: {},
45
- rank: {}
45
+ rank: {start: 10, end: Number.NaN}
46
46
  },
47
47
  ui: {
48
+ showCongrats: false,
48
49
  currentSlideRef: sliderSlide._id,
49
50
  navigation: ['skills', 'slides'],
50
51
  answers: {},
@@ -55,7 +56,8 @@ const initialState: StoreState = {
55
56
  animateCorrectionPopin: false,
56
57
  showCorrectionPopin: false
57
58
  }
58
- }
59
+ },
60
+ showQuitPopin: false
59
61
  }
60
62
  };
61
63
 
@@ -43,9 +43,10 @@ const initialState: StoreState = {
43
43
  skills: [],
44
44
  token: '1234',
45
45
  corrections: {},
46
- rank: {}
46
+ rank: {start: 10, end: Number.NaN}
47
47
  },
48
48
  ui: {
49
+ showCongrats: false,
49
50
  currentSlideRef: templateSlide._id,
50
51
  navigation: ['skills', 'slides'],
51
52
  answers: {},
@@ -56,7 +57,8 @@ const initialState: StoreState = {
56
57
  animateCorrectionPopin: false,
57
58
  showCorrectionPopin: false
58
59
  }
59
- }
60
+ },
61
+ showQuitPopin: false
60
62
  }
61
63
  };
62
64