@coorpacademy/app-review 0.2.12-alpha.0 → 0.3.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.
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,47 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import test from 'ava';
13
- import identity from 'lodash/fp/identity';
14
- import { mapApiSlideToUi } from '../map-api-slide-to-ui';
15
- import { qcmUISlide, qcmSlide } from './fixtures/qcm';
16
- import { qcmDragUISlide, qcmDragSlide } from './fixtures/qcm-drag';
17
- import { freeTextSlide, freeTextUISlide } from './fixtures/free-text';
18
- import { qcmGraphicUISlide, qcmGraphicSlide } from './fixtures/qcm-graphic';
19
- import { templateSlide, templateUISlide } from './fixtures/template';
20
- import { sliderSlide, sliderUISlide } from './fixtures/slider';
21
- var _mapApiSlideToUi = mapApiSlideToUi(identity);
22
- var macro = test.macro({
23
- title: function (providedTitle) {
24
- return "should handle ".concat(providedTitle, " conversion").trim();
25
- },
26
- exec: function (t, arg) {
27
- t.deepEqual(JSON.parse(JSON.stringify(_mapApiSlideToUi(arg.slide, arg.answers))), JSON.parse(JSON.stringify(arg.expectedUiSlide)));
28
- }
29
- });
30
- test('qcm', macro, { slide: qcmSlide, answers: [], expectedUiSlide: qcmUISlide });
31
- test('qcm drag', macro, { slide: qcmDragSlide, answers: [], expectedUiSlide: qcmDragUISlide });
32
- test('qcm graphic', macro, {
33
- slide: qcmGraphicSlide,
34
- answers: [],
35
- expectedUiSlide: qcmGraphicUISlide
36
- });
37
- test('template', macro, {
38
- slide: templateSlide,
39
- answers: [],
40
- expectedUiSlide: templateUISlide
41
- });
42
- test('free text', macro, { slide: freeTextSlide, answers: [], expectedUiSlide: freeTextUISlide });
43
- test('slider', macro, { slide: sliderSlide, answers: [], expectedUiSlide: sliderUISlide });
44
- test('should throw an error if the question type can not be handled', function (t) {
45
- var faultySlide = __assign(__assign({}, qcmSlide), { question: { type: 'lol' } });
46
- t.throws(function () { return _mapApiSlideToUi(faultySlide, []); });
47
- });
@@ -1,74 +0,0 @@
1
- var _a;
2
- import test from 'ava';
3
- import omit from 'lodash/fp/omit';
4
- import get from 'lodash/fp/get';
5
- import { mapStateToSlidesProps } from '..';
6
- import { services } from '../../../test/util/services.mock';
7
- import { createTestStore } from '../../../actions/test/create-test-store';
8
- import { EDIT_BASIC } from '../../../actions/ui/answers';
9
- import { freeTextSlide } from './fixtures/free-text';
10
- var progression = {
11
- _id: '123456789123',
12
- content: { type: 'skill', ref: '_skill-ref' },
13
- engine: {
14
- ref: 'review'
15
- },
16
- state: {
17
- allAnswers: [],
18
- isCorrect: true,
19
- nextContent: {
20
- ref: freeTextSlide._id,
21
- type: 'slide'
22
- },
23
- pendingSlides: [],
24
- slides: [],
25
- step: {
26
- current: 1
27
- },
28
- stars: 0
29
- }
30
- };
31
- var initialState = {
32
- data: {
33
- progression: progression,
34
- slides: (_a = {},
35
- _a[freeTextSlide._id] = freeTextSlide,
36
- _a),
37
- skills: [],
38
- token: '1234',
39
- corrections: {},
40
- rank: {}
41
- },
42
- ui: {
43
- currentSlideRef: freeTextSlide._id,
44
- navigation: ['skills', 'slides'],
45
- answers: [],
46
- slide: {
47
- validateButton: false
48
- }
49
- }
50
- };
51
- test('should dispatch EDIT_BASIC action via the property onChange of a Free Text slide', function (t) {
52
- var _a;
53
- t.plan(2);
54
- var expectedActions = [
55
- {
56
- type: EDIT_BASIC,
57
- payload: ['My Answer']
58
- }
59
- ];
60
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
61
- var 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: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
70
- });
71
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
72
- var onChange = get('onChange', SlideProps);
73
- onChange('My Answer');
74
- });
@@ -1,74 +0,0 @@
1
- var _a;
2
- import test from 'ava';
3
- import omit from 'lodash/fp/omit';
4
- import get from 'lodash/fp/get';
5
- import { mapStateToSlidesProps } from '..';
6
- import { services } from '../../../test/util/services.mock';
7
- import { createTestStore } from '../../../actions/test/create-test-store';
8
- import { EDIT_QCM_DRAG } from '../../../actions/ui/answers';
9
- import { qcmDragSlide } from './fixtures/qcm-drag';
10
- var progression = {
11
- _id: '123456789123',
12
- content: { type: 'skill', ref: '_skill-ref' },
13
- engine: {
14
- ref: 'review'
15
- },
16
- state: {
17
- allAnswers: [],
18
- isCorrect: true,
19
- nextContent: {
20
- ref: qcmDragSlide._id,
21
- type: 'slide'
22
- },
23
- pendingSlides: [],
24
- slides: [],
25
- step: {
26
- current: 1
27
- },
28
- stars: 0
29
- }
30
- };
31
- var initialState = {
32
- data: {
33
- progression: progression,
34
- slides: (_a = {},
35
- _a[qcmDragSlide._id] = qcmDragSlide,
36
- _a),
37
- skills: [],
38
- token: '1234',
39
- corrections: {},
40
- rank: {}
41
- },
42
- ui: {
43
- currentSlideRef: qcmDragSlide._id,
44
- navigation: ['skills', 'slides'],
45
- answers: [],
46
- slide: {
47
- validateButton: false
48
- }
49
- }
50
- };
51
- test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Drag slide', function (t) {
52
- var _a;
53
- t.plan(2);
54
- var expectedActions = [
55
- {
56
- type: EDIT_QCM_DRAG,
57
- payload: ['La démoralisation']
58
- }
59
- ];
60
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
61
- var 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 "Using redux" chapter',
69
- questionText: "Remettez dans l'ordre les quatre étapes du burn out."
70
- });
71
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
72
- var onClick = get(['0', 'onClick'], SlideProps.answers);
73
- onClick();
74
- });
@@ -1,74 +0,0 @@
1
- var _a;
2
- import test from 'ava';
3
- import omit from 'lodash/fp/omit';
4
- import get from 'lodash/fp/get';
5
- import { mapStateToSlidesProps } from '..';
6
- import { services } from '../../../test/util/services.mock';
7
- import { createTestStore } from '../../../actions/test/create-test-store';
8
- import { EDIT_QCM_GRAPHIC } from '../../../actions/ui/answers';
9
- import { qcmGraphicSlide } from './fixtures/qcm-graphic';
10
- var progression = {
11
- _id: '123456789123',
12
- content: { type: 'skill', ref: '_skill-ref' },
13
- engine: {
14
- ref: 'review'
15
- },
16
- state: {
17
- allAnswers: [],
18
- isCorrect: true,
19
- nextContent: {
20
- ref: qcmGraphicSlide._id,
21
- type: 'slide'
22
- },
23
- pendingSlides: [],
24
- slides: [],
25
- step: {
26
- current: 1
27
- },
28
- stars: 0
29
- }
30
- };
31
- var initialState = {
32
- data: {
33
- progression: progression,
34
- slides: (_a = {},
35
- _a[qcmGraphicSlide._id] = qcmGraphicSlide,
36
- _a),
37
- skills: [],
38
- token: '1234',
39
- corrections: {},
40
- rank: {}
41
- },
42
- ui: {
43
- currentSlideRef: qcmGraphicSlide._id,
44
- navigation: ['skills', 'slides'],
45
- answers: [],
46
- slide: {
47
- validateButton: false
48
- }
49
- }
50
- };
51
- test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM Graphic slide', function (t) {
52
- var _a;
53
- t.plan(2);
54
- var expectedActions = [
55
- {
56
- type: EDIT_QCM_GRAPHIC,
57
- payload: ['Le retour d’information']
58
- }
59
- ];
60
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
61
- var 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: 'Quels sont les 4 piliers de l’apprentissage ?'
70
- });
71
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
72
- var onClick = get(['1', 'onClick'], SlideProps.answers);
73
- onClick();
74
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,76 +0,0 @@
1
- var _a;
2
- import test from 'ava';
3
- import omit from 'lodash/fp/omit';
4
- import get from 'lodash/fp/get';
5
- import { mapStateToSlidesProps } from '..';
6
- import { services } from '../../../test/util/services.mock';
7
- import { createTestStore } from '../../../actions/test/create-test-store';
8
- import { EDIT_QCM } from '../../../actions/ui/answers';
9
- import { qcmSlide } from './fixtures/qcm';
10
- var progression = {
11
- _id: '123456789123',
12
- content: { type: 'skill', ref: '_skill-ref' },
13
- engine: {
14
- ref: 'review'
15
- },
16
- state: {
17
- allAnswers: [],
18
- isCorrect: true,
19
- nextContent: {
20
- ref: qcmSlide._id,
21
- type: 'slide'
22
- },
23
- pendingSlides: [],
24
- slides: [],
25
- step: {
26
- current: 1
27
- },
28
- stars: 0
29
- }
30
- };
31
- var initialState = {
32
- data: {
33
- progression: progression,
34
- slides: (_a = {},
35
- _a[qcmSlide._id] = qcmSlide,
36
- _a),
37
- skills: [],
38
- token: '1234',
39
- corrections: {},
40
- rank: {}
41
- },
42
- ui: {
43
- currentSlideRef: qcmSlide._id,
44
- navigation: ['skills', 'slides'],
45
- answers: [],
46
- slide: {
47
- validateButton: false
48
- }
49
- }
50
- };
51
- test('should dispatch EDIT_QCM action via the property onClick of a QCM slide', function (t) {
52
- var _a;
53
- t.plan(2);
54
- var expectedActions = [
55
- {
56
- type: EDIT_QCM,
57
- payload: [
58
- "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
59
- ]
60
- }
61
- ];
62
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
63
- var props = mapStateToSlidesProps(getState(), dispatch);
64
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
65
- animateCorrectionPopin: false,
66
- showCorrectionPopin: false,
67
- hidden: false,
68
- position: 0,
69
- loading: false,
70
- parentContentTitle: 'From "Developing the review app" course',
71
- questionText: "Après la vente d'un NFT, son créateur peut-il toucher de l'argent ?"
72
- });
73
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
74
- var onClick = get(['1', 'onClick'], SlideProps.answers);
75
- onClick();
76
- });
@@ -1,75 +0,0 @@
1
- var _a;
2
- import test from 'ava';
3
- import omit from 'lodash/fp/omit';
4
- import get from 'lodash/fp/get';
5
- import { mapStateToSlidesProps } from '..';
6
- import { services } from '../../../test/util/services.mock';
7
- import { createTestStore } from '../../../actions/test/create-test-store';
8
- import { EDIT_SLIDER } from '../../../actions/ui/answers';
9
- import { sliderSlide } from './fixtures/slider';
10
- var progression = {
11
- _id: '123456789123',
12
- content: { type: 'skill', ref: '_skill-ref' },
13
- engine: {
14
- ref: 'review'
15
- },
16
- state: {
17
- allAnswers: [],
18
- isCorrect: true,
19
- nextContent: {
20
- ref: sliderSlide._id,
21
- type: 'slide'
22
- },
23
- pendingSlides: [],
24
- slides: [],
25
- step: {
26
- current: 1
27
- },
28
- stars: 0
29
- }
30
- };
31
- var initialState = {
32
- data: {
33
- progression: progression,
34
- slides: (_a = {},
35
- _a[sliderSlide._id] = sliderSlide,
36
- _a),
37
- skills: [],
38
- token: '1234',
39
- corrections: {},
40
- rank: {}
41
- },
42
- ui: {
43
- currentSlideRef: sliderSlide._id,
44
- navigation: ['skills', 'slides'],
45
- answers: [],
46
- slide: {
47
- validateButton: false
48
- }
49
- }
50
- };
51
- test('should dispatch EDIT_SLIDER action via the property onChange of a Slider slide', function (t) {
52
- var _a;
53
- t.plan(2);
54
- var expectedActions = [
55
- {
56
- type: EDIT_SLIDER,
57
- payload: ['5']
58
- }
59
- ];
60
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
61
- var 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: 'En combien d’années la communauté de communes du Thouarsais est-elle passée de zéro à un tiers d’énergies renouvelables ?'
70
- });
71
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
72
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
73
- var onChange = get('onChange', SlideProps);
74
- onChange(0.29339261968085106);
75
- });
@@ -1,65 +0,0 @@
1
- var _a;
2
- import test from 'ava';
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
- var 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
- var initialState = {
31
- data: {
32
- progression: progression,
33
- slides: (_a = {},
34
- _a[sliderSlide._id] = sliderSlide,
35
- _a),
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 onSliderChange of a Slider slide', function (t) {
51
- var _a;
52
- t.plan(1);
53
- var expectedActions = [
54
- {
55
- type: EDIT_SLIDER,
56
- payload: ['111']
57
- }
58
- ];
59
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
60
- var props = mapStateToSlidesProps(getState(), dispatch);
61
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
62
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
63
- var onSliderChange = get('onSliderChange', SlideProps);
64
- onSliderChange(111);
65
- });
@@ -1,88 +0,0 @@
1
- var _a;
2
- import test from 'ava';
3
- import omit from 'lodash/fp/omit';
4
- import get from 'lodash/fp/get';
5
- import { mapStateToSlidesProps } from '..';
6
- import { services } from '../../../test/util/services.mock';
7
- import { createTestStore } from '../../../actions/test/create-test-store';
8
- import { EDIT_TEMPLATE } from '../../../actions/ui/answers';
9
- import { templateSlide } from './fixtures/template';
10
- var progression = {
11
- _id: '123456789123',
12
- content: { type: 'skill', ref: '_skill-ref' },
13
- engine: {
14
- ref: 'review'
15
- },
16
- state: {
17
- allAnswers: [],
18
- isCorrect: true,
19
- nextContent: {
20
- ref: templateSlide._id,
21
- type: 'slide'
22
- },
23
- pendingSlides: [],
24
- slides: [],
25
- step: {
26
- current: 1
27
- },
28
- stars: 0
29
- }
30
- };
31
- var initialState = {
32
- data: {
33
- progression: progression,
34
- slides: (_a = {},
35
- _a[templateSlide._id] = templateSlide,
36
- _a),
37
- skills: [],
38
- token: '1234',
39
- corrections: {},
40
- rank: {}
41
- },
42
- ui: {
43
- currentSlideRef: templateSlide._id,
44
- navigation: ['skills', 'slides'],
45
- answers: [],
46
- slide: {
47
- validateButton: false
48
- }
49
- }
50
- };
51
- test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Text slide', function (t) {
52
- var _a;
53
- t.plan(2);
54
- var expectedActions = [{ type: EDIT_TEMPLATE, payload: ['', 'test', ''] }];
55
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
56
- var props = mapStateToSlidesProps(getState(), dispatch);
57
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
58
- animateCorrectionPopin: false,
59
- showCorrectionPopin: false,
60
- hidden: false,
61
- position: 0,
62
- loading: false,
63
- parentContentTitle: 'From "Developing the review app" course',
64
- questionText: 'Complétez la phrase ci-dessous.'
65
- });
66
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
67
- var onChange = get(['1', 'onChange'], SlideProps.answers);
68
- onChange('test');
69
- });
70
- test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Select slide', function (t) {
71
- var _a;
72
- t.plan(2);
73
- var expectedActions = [{ type: EDIT_TEMPLATE, payload: ['Catalogue', '', ''] }];
74
- var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
75
- var props = mapStateToSlidesProps(getState(), dispatch);
76
- t.deepEqual(omit('answerUI', props.stack.slides['0']), {
77
- animateCorrectionPopin: false,
78
- showCorrectionPopin: false,
79
- hidden: false,
80
- position: 0,
81
- loading: false,
82
- parentContentTitle: 'From "Developing the review app" course',
83
- questionText: 'Complétez la phrase ci-dessous.'
84
- });
85
- var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
86
- var onChange = get(['0', 'onChange'], SlideProps.answers);
87
- onChange('Catalogue');
88
- });