@coorpacademy/app-review 0.2.12 → 0.3.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/es/actions/api/fetch-correction.js +1 -1
  2. package/es/actions/api/post-answer.d.ts +6 -0
  3. package/es/actions/api/post-answer.js +3 -1
  4. package/es/actions/ui/answers.d.ts +3 -0
  5. package/es/actions/ui/answers.js +3 -1
  6. package/es/reducers/index.d.ts +1 -1
  7. package/es/reducers/ui/answers.d.ts +4 -2
  8. package/es/reducers/ui/answers.js +6 -3
  9. package/es/reducers/ui/index.d.ts +4 -4
  10. package/es/reducers/ui/slide.d.ts +6 -4
  11. package/es/reducers/ui/slide.js +12 -4
  12. package/es/views/slides/index.js +4 -4
  13. package/lib/actions/api/fetch-correction.js +1 -1
  14. package/lib/actions/api/post-answer.d.ts +6 -0
  15. package/lib/actions/api/post-answer.js +4 -2
  16. package/lib/actions/ui/answers.d.ts +3 -0
  17. package/lib/actions/ui/answers.js +3 -1
  18. package/lib/reducers/index.d.ts +1 -1
  19. package/lib/reducers/ui/answers.d.ts +4 -2
  20. package/lib/reducers/ui/answers.js +6 -3
  21. package/lib/reducers/ui/index.d.ts +4 -4
  22. package/lib/reducers/ui/slide.d.ts +6 -4
  23. package/lib/reducers/ui/slide.js +12 -4
  24. package/lib/views/slides/index.js +4 -4
  25. package/package.json +4 -4
  26. package/src/actions/api/fetch-correction.ts +1 -1
  27. package/src/actions/api/post-answer.ts +5 -1
  28. package/src/actions/api/test/fetch-correction.test.ts +6 -2
  29. package/src/actions/api/test/fetch-rank.test.ts +2 -4
  30. package/src/actions/api/test/fetch-skills.test.ts +2 -4
  31. package/src/actions/api/test/fetch-slide.test.ts +2 -4
  32. package/src/actions/api/test/post-answer.test.ts +52 -13
  33. package/src/actions/api/test/post-progression.test.ts +2 -4
  34. package/src/actions/data/test/token.test.ts +2 -4
  35. package/src/actions/ui/answers.ts +4 -1
  36. package/src/actions/ui/test/answers.test.ts +38 -14
  37. package/src/actions/ui/test/next-slide.test.ts +8 -4
  38. package/src/actions/ui/test/slides.test.ts +2 -4
  39. package/src/reducers/data/test/progression.test.ts +1 -0
  40. package/src/reducers/ui/answers.ts +11 -5
  41. package/src/reducers/ui/index.ts +2 -2
  42. package/src/reducers/ui/slide.ts +30 -9
  43. package/src/reducers/ui/test/answers.test.ts +61 -13
  44. package/src/reducers/ui/test/slide.test.ts +36 -7
  45. package/src/views/skills/test/skills.test.ts +4 -8
  46. package/src/views/slides/index.ts +4 -4
  47. package/src/views/slides/test/index.test.ts +173 -28
  48. package/src/views/slides/test/slide.free-text.on-change.test.ts +7 -2
  49. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +7 -2
  50. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +7 -2
  51. package/src/views/slides/test/slide.qcm.on-click.test.ts +7 -2
  52. package/src/views/slides/test/slide.slider.on-change.test.ts +7 -2
  53. package/src/views/slides/test/slide.slider.on-slider-change.test.ts +7 -2
  54. package/src/views/slides/test/slide.template.on-change.test.ts +12 -4
  55. package/es/actions/api/test/fetch-correction.test.d.ts +0 -1
  56. package/es/actions/api/test/fetch-correction.test.js +0 -91
  57. package/es/actions/api/test/fetch-rank.test.d.ts +0 -1
  58. package/es/actions/api/test/fetch-rank.test.js +0 -100
  59. package/es/actions/api/test/fetch-skills.test.d.ts +0 -1
  60. package/es/actions/api/test/fetch-skills.test.js +0 -61
  61. package/es/actions/api/test/fetch-slide.test.d.ts +0 -1
  62. package/es/actions/api/test/fetch-slide.test.js +0 -68
  63. package/es/actions/api/test/post-answer.test.d.ts +0 -1
  64. package/es/actions/api/test/post-answer.test.js +0 -172
  65. package/es/actions/api/test/post-progression.test.d.ts +0 -1
  66. package/es/actions/api/test/post-progression.test.js +0 -109
  67. package/es/actions/data/test/token.test.d.ts +0 -1
  68. package/es/actions/data/test/token.test.js +0 -27
  69. package/es/actions/ui/test/answers.test.d.ts +0 -1
  70. package/es/actions/ui/test/answers.test.js +0 -117
  71. package/es/actions/ui/test/next-slide.test.d.ts +0 -1
  72. package/es/actions/ui/test/next-slide.test.js +0 -63
  73. package/es/actions/ui/test/slides.test.d.ts +0 -1
  74. package/es/actions/ui/test/slides.test.js +0 -28
  75. package/es/reducers/data/test/corrections.test.d.ts +0 -1
  76. package/es/reducers/data/test/corrections.test.js +0 -27
  77. package/es/reducers/data/test/progression.test.d.ts +0 -1
  78. package/es/reducers/data/test/progression.test.js +0 -24
  79. package/es/reducers/data/test/rank.test.d.ts +0 -1
  80. package/es/reducers/data/test/rank.test.js +0 -59
  81. package/es/reducers/data/test/skills.test.d.ts +0 -1
  82. package/es/reducers/data/test/skills.test.js +0 -12
  83. package/es/reducers/data/test/slides.test.d.ts +0 -1
  84. package/es/reducers/data/test/slides.test.js +0 -21
  85. package/es/reducers/data/test/token.test.d.ts +0 -1
  86. package/es/reducers/data/test/token.test.js +0 -11
  87. package/es/reducers/ui/test/answers.test.d.ts +0 -1
  88. package/es/reducers/ui/test/answers.test.js +0 -31
  89. package/es/reducers/ui/test/current-slide-ref.test.d.ts +0 -1
  90. package/es/reducers/ui/test/current-slide-ref.test.js +0 -12
  91. package/es/reducers/ui/test/navigation.test.d.ts +0 -1
  92. package/es/reducers/ui/test/navigation.test.js +0 -15
  93. package/es/reducers/ui/test/slide.test.d.ts +0 -1
  94. package/es/reducers/ui/test/slide.test.js +0 -24
  95. package/es/services/test/fetch-correction.test.d.ts +0 -1
  96. package/es/services/test/fetch-correction.test.js +0 -39
  97. package/es/services/test/fetch-rank.test.d.ts +0 -1
  98. package/es/services/test/fetch-rank.test.js +0 -24
  99. package/es/services/test/fetch-skills.test.d.ts +0 -1
  100. package/es/services/test/fetch-skills.test.js +0 -29
  101. package/es/services/test/fetch-slide.test.d.ts +0 -1
  102. package/es/services/test/fetch-slide.test.js +0 -22
  103. package/es/services/test/post-answer.test.d.ts +0 -1
  104. package/es/services/test/post-answer.test.js +0 -88
  105. package/es/services/test/post-progression.test.d.ts +0 -1
  106. package/es/services/test/post-progression.test.js +0 -56
  107. package/es/views/skills/test/skills.test.d.ts +0 -1
  108. package/es/views/skills/test/skills.test.js +0 -98
  109. package/es/views/slides/test/index.test.d.ts +0 -1
  110. package/es/views/slides/test/index.test.js +0 -979
  111. package/es/views/slides/test/map-api-slide-to-ui.test.d.ts +0 -1
  112. package/es/views/slides/test/map-api-slide-to-ui.test.js +0 -36
  113. package/es/views/slides/test/slide.free-text.on-change.test.d.ts +0 -1
  114. package/es/views/slides/test/slide.free-text.on-change.test.js +0 -72
  115. package/es/views/slides/test/slide.qcm-drag.on-click.test.d.ts +0 -1
  116. package/es/views/slides/test/slide.qcm-drag.on-click.test.js +0 -72
  117. package/es/views/slides/test/slide.qcm-graphic.on-click.test.d.ts +0 -1
  118. package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +0 -72
  119. package/es/views/slides/test/slide.qcm.on-click.test.d.ts +0 -1
  120. package/es/views/slides/test/slide.qcm.on-click.test.js +0 -74
  121. package/es/views/slides/test/slide.slider.on-change.test.d.ts +0 -1
  122. package/es/views/slides/test/slide.slider.on-change.test.js +0 -73
  123. package/es/views/slides/test/slide.slider.on-slider-change.test.d.ts +0 -1
  124. package/es/views/slides/test/slide.slider.on-slider-change.test.js +0 -63
  125. package/es/views/slides/test/slide.template.on-change.test.d.ts +0 -1
  126. package/es/views/slides/test/slide.template.on-change.test.js +0 -85
  127. package/lib/actions/api/test/fetch-correction.test.d.ts +0 -1
  128. package/lib/actions/api/test/fetch-correction.test.js +0 -151
  129. package/lib/actions/api/test/fetch-rank.test.d.ts +0 -1
  130. package/lib/actions/api/test/fetch-rank.test.js +0 -171
  131. package/lib/actions/api/test/fetch-skills.test.d.ts +0 -1
  132. package/lib/actions/api/test/fetch-skills.test.js +0 -120
  133. package/lib/actions/api/test/fetch-slide.test.d.ts +0 -1
  134. package/lib/actions/api/test/fetch-slide.test.js +0 -127
  135. package/lib/actions/api/test/post-answer.test.d.ts +0 -1
  136. package/lib/actions/api/test/post-answer.test.js +0 -254
  137. package/lib/actions/api/test/post-progression.test.d.ts +0 -1
  138. package/lib/actions/api/test/post-progression.test.js +0 -167
  139. package/lib/actions/data/test/token.test.d.ts +0 -1
  140. package/lib/actions/data/test/token.test.js +0 -72
  141. package/lib/actions/ui/test/answers.test.d.ts +0 -1
  142. package/lib/actions/ui/test/answers.test.js +0 -233
  143. package/lib/actions/ui/test/next-slide.test.d.ts +0 -1
  144. package/lib/actions/ui/test/next-slide.test.js +0 -64
  145. package/lib/actions/ui/test/slides.test.d.ts +0 -1
  146. package/lib/actions/ui/test/slides.test.js +0 -73
  147. package/lib/reducers/data/test/corrections.test.d.ts +0 -1
  148. package/lib/reducers/data/test/corrections.test.js +0 -28
  149. package/lib/reducers/data/test/progression.test.d.ts +0 -1
  150. package/lib/reducers/data/test/progression.test.js +0 -24
  151. package/lib/reducers/data/test/rank.test.d.ts +0 -1
  152. package/lib/reducers/data/test/rank.test.js +0 -59
  153. package/lib/reducers/data/test/skills.test.d.ts +0 -1
  154. package/lib/reducers/data/test/skills.test.js +0 -12
  155. package/lib/reducers/data/test/slides.test.d.ts +0 -1
  156. package/lib/reducers/data/test/slides.test.js +0 -22
  157. package/lib/reducers/data/test/token.test.d.ts +0 -1
  158. package/lib/reducers/data/test/token.test.js +0 -11
  159. package/lib/reducers/ui/test/answers.test.d.ts +0 -1
  160. package/lib/reducers/ui/test/answers.test.js +0 -31
  161. package/lib/reducers/ui/test/current-slide-ref.test.d.ts +0 -1
  162. package/lib/reducers/ui/test/current-slide-ref.test.js +0 -12
  163. package/lib/reducers/ui/test/navigation.test.d.ts +0 -1
  164. package/lib/reducers/ui/test/navigation.test.js +0 -15
  165. package/lib/reducers/ui/test/slide.test.d.ts +0 -1
  166. package/lib/reducers/ui/test/slide.test.js +0 -24
  167. package/lib/services/test/fetch-correction.test.d.ts +0 -1
  168. package/lib/services/test/fetch-correction.test.js +0 -95
  169. package/lib/services/test/fetch-rank.test.d.ts +0 -1
  170. package/lib/services/test/fetch-rank.test.js +0 -78
  171. package/lib/services/test/fetch-skills.test.d.ts +0 -1
  172. package/lib/services/test/fetch-skills.test.js +0 -83
  173. package/lib/services/test/fetch-slide.test.d.ts +0 -1
  174. package/lib/services/test/fetch-slide.test.js +0 -76
  175. package/lib/services/test/post-answer.test.d.ts +0 -1
  176. package/lib/services/test/post-answer.test.js +0 -142
  177. package/lib/services/test/post-progression.test.d.ts +0 -1
  178. package/lib/services/test/post-progression.test.js +0 -110
  179. package/lib/views/skills/test/skills.test.d.ts +0 -1
  180. package/lib/views/skills/test/skills.test.js +0 -98
  181. package/lib/views/slides/test/index.test.d.ts +0 -1
  182. package/lib/views/slides/test/index.test.js +0 -990
  183. package/lib/views/slides/test/map-api-slide-to-ui.test.d.ts +0 -1
  184. package/lib/views/slides/test/map-api-slide-to-ui.test.js +0 -47
  185. package/lib/views/slides/test/slide.free-text.on-change.test.d.ts +0 -1
  186. package/lib/views/slides/test/slide.free-text.on-change.test.js +0 -74
  187. package/lib/views/slides/test/slide.qcm-drag.on-click.test.d.ts +0 -1
  188. package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +0 -74
  189. package/lib/views/slides/test/slide.qcm-graphic.on-click.test.d.ts +0 -1
  190. package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +0 -74
  191. package/lib/views/slides/test/slide.qcm.on-click.test.d.ts +0 -1
  192. package/lib/views/slides/test/slide.qcm.on-click.test.js +0 -76
  193. package/lib/views/slides/test/slide.slider.on-change.test.d.ts +0 -1
  194. package/lib/views/slides/test/slide.slider.on-change.test.js +0 -75
  195. package/lib/views/slides/test/slide.slider.on-slider-change.test.d.ts +0 -1
  196. package/lib/views/slides/test/slide.slider.on-slider-change.test.js +0 -65
  197. package/lib/views/slides/test/slide.template.on-change.test.d.ts +0 -1
  198. package/lib/views/slides/test/slide.template.on-change.test.js +0 -88
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- import test from 'ava';
2
- import identity from 'lodash/fp/identity';
3
- import { mapApiSlideToUi } from '../map-api-slide-to-ui';
4
- import { qcmUISlide, qcmSlide } from './fixtures/qcm';
5
- import { qcmDragUISlide, qcmDragSlide } from './fixtures/qcm-drag';
6
- import { freeTextSlide, freeTextUISlide } from './fixtures/free-text';
7
- import { qcmGraphicUISlide, qcmGraphicSlide } from './fixtures/qcm-graphic';
8
- import { templateSlide, templateUISlide } from './fixtures/template';
9
- import { sliderSlide, sliderUISlide } from './fixtures/slider';
10
- const _mapApiSlideToUi = mapApiSlideToUi(identity);
11
- const macro = test.macro({
12
- title(providedTitle) {
13
- return `should handle ${providedTitle} conversion`.trim();
14
- },
15
- exec(t, arg) {
16
- t.deepEqual(JSON.parse(JSON.stringify(_mapApiSlideToUi(arg.slide, arg.answers))), JSON.parse(JSON.stringify(arg.expectedUiSlide)));
17
- }
18
- });
19
- test('qcm', macro, { slide: qcmSlide, answers: [], expectedUiSlide: qcmUISlide });
20
- test('qcm drag', macro, { slide: qcmDragSlide, answers: [], expectedUiSlide: qcmDragUISlide });
21
- test('qcm graphic', macro, {
22
- slide: qcmGraphicSlide,
23
- answers: [],
24
- expectedUiSlide: qcmGraphicUISlide
25
- });
26
- test('template', macro, {
27
- slide: templateSlide,
28
- answers: [],
29
- expectedUiSlide: templateUISlide
30
- });
31
- test('free text', macro, { slide: freeTextSlide, answers: [], expectedUiSlide: freeTextUISlide });
32
- test('slider', macro, { slide: sliderSlide, answers: [], expectedUiSlide: sliderUISlide });
33
- test('should throw an error if the question type can not be handled', t => {
34
- const faultySlide = { ...qcmSlide, question: { type: 'lol' } };
35
- t.throws(() => _mapApiSlideToUi(faultySlide, []));
36
- });
@@ -1,72 +0,0 @@
1
- import test from 'ava';
2
- import omit from 'lodash/fp/omit';
3
- import get from 'lodash/fp/get';
4
- import { mapStateToSlidesProps } from '..';
5
- import { services } from '../../../test/util/services.mock';
6
- import { createTestStore } from '../../../actions/test/create-test-store';
7
- import { EDIT_BASIC } from '../../../actions/ui/answers';
8
- import { freeTextSlide } from './fixtures/free-text';
9
- const progression = {
10
- _id: '123456789123',
11
- content: { type: 'skill', ref: '_skill-ref' },
12
- engine: {
13
- ref: 'review'
14
- },
15
- state: {
16
- allAnswers: [],
17
- isCorrect: true,
18
- nextContent: {
19
- ref: freeTextSlide._id,
20
- type: 'slide'
21
- },
22
- pendingSlides: [],
23
- slides: [],
24
- step: {
25
- current: 1
26
- },
27
- stars: 0
28
- }
29
- };
30
- const initialState = {
31
- data: {
32
- progression,
33
- slides: {
34
- [freeTextSlide._id]: freeTextSlide
35
- },
36
- skills: [],
37
- token: '1234',
38
- corrections: {},
39
- rank: {}
40
- },
41
- ui: {
42
- currentSlideRef: freeTextSlide._id,
43
- navigation: ['skills', 'slides'],
44
- answers: [],
45
- slide: {
46
- validateButton: false
47
- }
48
- }
49
- };
50
- test('should dispatch EDIT_BASIC action via the property onChange of a Free Text slide', t => {
51
- t.plan(2);
52
- const expectedActions = [
53
- {
54
- type: EDIT_BASIC,
55
- payload: ['My Answer']
56
- }
57
- ];
58
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
59
- const props = mapStateToSlidesProps(getState(), dispatch);
60
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
61
- animateCorrectionPopin: false,
62
- showCorrectionPopin: false,
63
- hidden: false,
64
- position: 0,
65
- loading: false,
66
- parentContentTitle: 'From "Developing the review app" course',
67
- questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
68
- });
69
- const SlideProps = props.stack.slides['0'].answerUI?.model;
70
- const onChange = get('onChange', SlideProps);
71
- onChange('My Answer');
72
- });
@@ -1,72 +0,0 @@
1
- import test from 'ava';
2
- import omit from 'lodash/fp/omit';
3
- import get from 'lodash/fp/get';
4
- import { mapStateToSlidesProps } from '..';
5
- import { services } from '../../../test/util/services.mock';
6
- import { createTestStore } from '../../../actions/test/create-test-store';
7
- import { EDIT_QCM_DRAG } from '../../../actions/ui/answers';
8
- import { qcmDragSlide } from './fixtures/qcm-drag';
9
- const progression = {
10
- _id: '123456789123',
11
- content: { type: 'skill', ref: '_skill-ref' },
12
- engine: {
13
- ref: 'review'
14
- },
15
- state: {
16
- allAnswers: [],
17
- isCorrect: true,
18
- nextContent: {
19
- ref: qcmDragSlide._id,
20
- type: 'slide'
21
- },
22
- pendingSlides: [],
23
- slides: [],
24
- step: {
25
- current: 1
26
- },
27
- stars: 0
28
- }
29
- };
30
- const initialState = {
31
- data: {
32
- progression,
33
- slides: {
34
- [qcmDragSlide._id]: qcmDragSlide
35
- },
36
- skills: [],
37
- token: '1234',
38
- corrections: {},
39
- rank: {}
40
- },
41
- ui: {
42
- currentSlideRef: qcmDragSlide._id,
43
- navigation: ['skills', 'slides'],
44
- answers: [],
45
- slide: {
46
- validateButton: false
47
- }
48
- }
49
- };
50
- test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Drag slide', t => {
51
- t.plan(2);
52
- const expectedActions = [
53
- {
54
- type: EDIT_QCM_DRAG,
55
- payload: ['La démoralisation']
56
- }
57
- ];
58
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
59
- const props = mapStateToSlidesProps(getState(), dispatch);
60
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
61
- animateCorrectionPopin: false,
62
- showCorrectionPopin: false,
63
- hidden: false,
64
- position: 0,
65
- loading: false,
66
- parentContentTitle: 'From "Using redux" chapter',
67
- questionText: "Remettez dans l'ordre les quatre étapes du burn out."
68
- });
69
- const SlideProps = props.stack.slides['0'].answerUI?.model;
70
- const onClick = get(['0', 'onClick'], SlideProps.answers);
71
- onClick();
72
- });
@@ -1,72 +0,0 @@
1
- import test from 'ava';
2
- import omit from 'lodash/fp/omit';
3
- import get from 'lodash/fp/get';
4
- import { mapStateToSlidesProps } from '..';
5
- import { services } from '../../../test/util/services.mock';
6
- import { createTestStore } from '../../../actions/test/create-test-store';
7
- import { EDIT_QCM_GRAPHIC } from '../../../actions/ui/answers';
8
- import { qcmGraphicSlide } from './fixtures/qcm-graphic';
9
- const progression = {
10
- _id: '123456789123',
11
- content: { type: 'skill', ref: '_skill-ref' },
12
- engine: {
13
- ref: 'review'
14
- },
15
- state: {
16
- allAnswers: [],
17
- isCorrect: true,
18
- nextContent: {
19
- ref: qcmGraphicSlide._id,
20
- type: 'slide'
21
- },
22
- pendingSlides: [],
23
- slides: [],
24
- step: {
25
- current: 1
26
- },
27
- stars: 0
28
- }
29
- };
30
- const initialState = {
31
- data: {
32
- progression,
33
- slides: {
34
- [qcmGraphicSlide._id]: qcmGraphicSlide
35
- },
36
- skills: [],
37
- token: '1234',
38
- corrections: {},
39
- rank: {}
40
- },
41
- ui: {
42
- currentSlideRef: qcmGraphicSlide._id,
43
- navigation: ['skills', 'slides'],
44
- answers: [],
45
- slide: {
46
- validateButton: false
47
- }
48
- }
49
- };
50
- test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM Graphic slide', t => {
51
- t.plan(2);
52
- const expectedActions = [
53
- {
54
- type: EDIT_QCM_GRAPHIC,
55
- payload: ['Le retour d’information']
56
- }
57
- ];
58
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
59
- const props = mapStateToSlidesProps(getState(), dispatch);
60
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
61
- animateCorrectionPopin: false,
62
- showCorrectionPopin: false,
63
- hidden: false,
64
- position: 0,
65
- loading: false,
66
- parentContentTitle: 'From "Developing the review app" course',
67
- questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
68
- });
69
- const SlideProps = props.stack.slides['0'].answerUI?.model;
70
- const onClick = get(['1', 'onClick'], SlideProps.answers);
71
- onClick();
72
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,74 +0,0 @@
1
- import test from 'ava';
2
- import omit from 'lodash/fp/omit';
3
- import get from 'lodash/fp/get';
4
- import { mapStateToSlidesProps } from '..';
5
- import { services } from '../../../test/util/services.mock';
6
- import { createTestStore } from '../../../actions/test/create-test-store';
7
- import { EDIT_QCM } from '../../../actions/ui/answers';
8
- import { qcmSlide } from './fixtures/qcm';
9
- const progression = {
10
- _id: '123456789123',
11
- content: { type: 'skill', ref: '_skill-ref' },
12
- engine: {
13
- ref: 'review'
14
- },
15
- state: {
16
- allAnswers: [],
17
- isCorrect: true,
18
- nextContent: {
19
- ref: qcmSlide._id,
20
- type: 'slide'
21
- },
22
- pendingSlides: [],
23
- slides: [],
24
- step: {
25
- current: 1
26
- },
27
- stars: 0
28
- }
29
- };
30
- const initialState = {
31
- data: {
32
- progression,
33
- slides: {
34
- [qcmSlide._id]: qcmSlide
35
- },
36
- skills: [],
37
- token: '1234',
38
- corrections: {},
39
- rank: {}
40
- },
41
- ui: {
42
- currentSlideRef: qcmSlide._id,
43
- navigation: ['skills', 'slides'],
44
- answers: [],
45
- slide: {
46
- validateButton: false
47
- }
48
- }
49
- };
50
- test('should dispatch EDIT_QCM action via the property onClick of a QCM slide', t => {
51
- t.plan(2);
52
- const expectedActions = [
53
- {
54
- type: EDIT_QCM,
55
- payload: [
56
- "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
57
- ]
58
- }
59
- ];
60
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
61
- const props = mapStateToSlidesProps(getState(), dispatch);
62
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
63
- animateCorrectionPopin: false,
64
- showCorrectionPopin: false,
65
- hidden: false,
66
- position: 0,
67
- loading: false,
68
- parentContentTitle: 'From "Developing the review app" course',
69
- questionText: "Après la vente d'un NFT, son créateur peut-il toucher de l'argent ?"
70
- });
71
- const SlideProps = props.stack.slides['0'].answerUI?.model;
72
- const onClick = get(['1', 'onClick'], SlideProps.answers);
73
- onClick();
74
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,73 +0,0 @@
1
- import test from 'ava';
2
- import omit from 'lodash/fp/omit';
3
- import get from 'lodash/fp/get';
4
- import { mapStateToSlidesProps } from '..';
5
- import { services } from '../../../test/util/services.mock';
6
- import { createTestStore } from '../../../actions/test/create-test-store';
7
- import { EDIT_SLIDER } from '../../../actions/ui/answers';
8
- import { sliderSlide } from './fixtures/slider';
9
- const progression = {
10
- _id: '123456789123',
11
- content: { type: 'skill', ref: '_skill-ref' },
12
- engine: {
13
- ref: 'review'
14
- },
15
- state: {
16
- allAnswers: [],
17
- isCorrect: true,
18
- nextContent: {
19
- ref: sliderSlide._id,
20
- type: 'slide'
21
- },
22
- pendingSlides: [],
23
- slides: [],
24
- step: {
25
- current: 1
26
- },
27
- stars: 0
28
- }
29
- };
30
- const initialState = {
31
- data: {
32
- progression,
33
- slides: {
34
- [sliderSlide._id]: sliderSlide
35
- },
36
- skills: [],
37
- token: '1234',
38
- corrections: {},
39
- rank: {}
40
- },
41
- ui: {
42
- currentSlideRef: sliderSlide._id,
43
- navigation: ['skills', 'slides'],
44
- answers: [],
45
- slide: {
46
- validateButton: false
47
- }
48
- }
49
- };
50
- test('should dispatch EDIT_SLIDER action via the property onChange of a Slider slide', t => {
51
- t.plan(2);
52
- const expectedActions = [
53
- {
54
- type: EDIT_SLIDER,
55
- payload: ['5']
56
- }
57
- ];
58
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
59
- const props = mapStateToSlidesProps(getState(), dispatch);
60
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
61
- animateCorrectionPopin: false,
62
- showCorrectionPopin: false,
63
- hidden: false,
64
- position: 0,
65
- loading: false,
66
- parentContentTitle: 'From "Developing the review app" course',
67
- questionText: 'En combien d’années la communauté de communes du Thouarsais est-elle passée de zéro à un tiers d’énergies renouvelables ?'
68
- });
69
- const SlideProps = props.stack.slides['0'].answerUI?.model;
70
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
- const onChange = get('onChange', SlideProps);
72
- onChange(0.29339261968085106);
73
- });
@@ -1,63 +0,0 @@
1
- import test from 'ava';
2
- import get from 'lodash/fp/get';
3
- import { mapStateToSlidesProps } from '..';
4
- import { services } from '../../../test/util/services.mock';
5
- import { createTestStore } from '../../../actions/test/create-test-store';
6
- import { EDIT_SLIDER } from '../../../actions/ui/answers';
7
- import { sliderSlide } from './fixtures/slider';
8
- const progression = {
9
- _id: '123456789123',
10
- content: { type: 'skill', ref: '_skill-ref' },
11
- engine: {
12
- ref: 'review'
13
- },
14
- state: {
15
- allAnswers: [],
16
- isCorrect: true,
17
- nextContent: {
18
- ref: sliderSlide._id,
19
- type: 'slide'
20
- },
21
- pendingSlides: [],
22
- slides: [],
23
- step: {
24
- current: 1
25
- },
26
- stars: 0
27
- }
28
- };
29
- const initialState = {
30
- data: {
31
- progression,
32
- slides: {
33
- [sliderSlide._id]: sliderSlide
34
- },
35
- skills: [],
36
- token: '1234',
37
- corrections: {},
38
- rank: {}
39
- },
40
- ui: {
41
- currentSlideRef: sliderSlide._id,
42
- navigation: ['skills', 'slides'],
43
- answers: [],
44
- slide: {
45
- validateButton: false
46
- }
47
- }
48
- };
49
- test('should dispatch EDIT_SLIDER action via the property onSliderChange of a Slider slide', t => {
50
- t.plan(1);
51
- const expectedActions = [
52
- {
53
- type: EDIT_SLIDER,
54
- payload: ['111']
55
- }
56
- ];
57
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
58
- const props = mapStateToSlidesProps(getState(), dispatch);
59
- const SlideProps = props.stack.slides['0'].answerUI?.model;
60
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
61
- const onSliderChange = get('onSliderChange', SlideProps);
62
- onSliderChange(111);
63
- });
@@ -1,85 +0,0 @@
1
- import test from 'ava';
2
- import omit from 'lodash/fp/omit';
3
- import get from 'lodash/fp/get';
4
- import { mapStateToSlidesProps } from '..';
5
- import { services } from '../../../test/util/services.mock';
6
- import { createTestStore } from '../../../actions/test/create-test-store';
7
- import { EDIT_TEMPLATE } from '../../../actions/ui/answers';
8
- import { templateSlide } from './fixtures/template';
9
- const progression = {
10
- _id: '123456789123',
11
- content: { type: 'skill', ref: '_skill-ref' },
12
- engine: {
13
- ref: 'review'
14
- },
15
- state: {
16
- allAnswers: [],
17
- isCorrect: true,
18
- nextContent: {
19
- ref: templateSlide._id,
20
- type: 'slide'
21
- },
22
- pendingSlides: [],
23
- slides: [],
24
- step: {
25
- current: 1
26
- },
27
- stars: 0
28
- }
29
- };
30
- const initialState = {
31
- data: {
32
- progression,
33
- slides: {
34
- [templateSlide._id]: templateSlide
35
- },
36
- skills: [],
37
- token: '1234',
38
- corrections: {},
39
- rank: {}
40
- },
41
- ui: {
42
- currentSlideRef: templateSlide._id,
43
- navigation: ['skills', 'slides'],
44
- answers: [],
45
- slide: {
46
- validateButton: false
47
- }
48
- }
49
- };
50
- test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Text slide', t => {
51
- t.plan(2);
52
- const expectedActions = [{ type: EDIT_TEMPLATE, payload: ['', 'test', ''] }];
53
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
54
- const props = mapStateToSlidesProps(getState(), dispatch);
55
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
56
- animateCorrectionPopin: false,
57
- showCorrectionPopin: false,
58
- hidden: false,
59
- position: 0,
60
- loading: false,
61
- parentContentTitle: 'From "Developing the review app" course',
62
- questionText: 'Complétez la phrase ci-dessous.'
63
- });
64
- const SlideProps = props.stack.slides['0'].answerUI?.model;
65
- const onChange = get(['1', 'onChange'], SlideProps.answers);
66
- onChange('test');
67
- });
68
- test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Select slide', t => {
69
- t.plan(2);
70
- const expectedActions = [{ type: EDIT_TEMPLATE, payload: ['Catalogue', '', ''] }];
71
- const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
72
- const props = mapStateToSlidesProps(getState(), dispatch);
73
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
74
- animateCorrectionPopin: false,
75
- showCorrectionPopin: false,
76
- hidden: false,
77
- position: 0,
78
- loading: false,
79
- parentContentTitle: 'From "Developing the review app" course',
80
- questionText: 'Complétez la phrase ci-dessous.'
81
- });
82
- const SlideProps = props.stack.slides['0'].answerUI?.model;
83
- const onChange = get(['0', 'onChange'], SlideProps.answers);
84
- onChange('Catalogue');
85
- });
@@ -1 +0,0 @@
1
- export {};