@coorpacademy/app-review 0.2.12 → 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 +2 -2
  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,151 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- var _a;
49
- import test from 'ava';
50
- import { getChoicesCorrection, postAnswerResponses, services as mockedServices } from '../../../test/util/services.mock';
51
- import { createTestStore } from '../../test/create-test-store';
52
- import { CORRECTION_FETCH_FAILURE, CORRECTION_FETCH_REQUEST, CORRECTION_FETCH_SUCCESS, fetchCorrection } from '../fetch-correction';
53
- import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
54
- import { qcmSlide } from '../../../views/slides/test/fixtures/qcm';
55
- var progression = postAnswerResponses[freeTextSlide.universalRef];
56
- var skillRef = '_skill-ref';
57
- var answer = ['Lister vos tâches pour vous libérer l’esprit', 'Vous isoler dans un lieu calme'];
58
- var initialState = {
59
- data: {
60
- progression: progression,
61
- slides: (_a = {},
62
- _a[freeTextSlide.universalRef] = freeTextSlide,
63
- _a[qcmSlide.universalRef] = qcmSlide,
64
- _a),
65
- skills: [{ skillRef: skillRef, custom: false, name: skillRef, slidesToReview: 5 }],
66
- token: '1234',
67
- corrections: {},
68
- rank: {}
69
- },
70
- ui: {
71
- currentSlideRef: freeTextSlide._id,
72
- navigation: ['skills', 'slides'],
73
- answers: answer,
74
- slide: {
75
- validateButton: false
76
- }
77
- }
78
- };
79
- test('should dispatch CORRECTION_FETCH_SUCCESS actions when fetchCorrection returns a correction object', function (t) { return __awaiter(void 0, void 0, void 0, function () {
80
- var services, expectedActions, dispatch;
81
- return __generator(this, function (_a) {
82
- switch (_a.label) {
83
- case 0:
84
- t.plan(6);
85
- services = __assign(__assign({}, mockedServices), { fetchCorrection: function (slideRef, token, progressionId, _answer) {
86
- t.is(slideRef, freeTextSlide.universalRef);
87
- t.is(token, '1234');
88
- t.is(progression._id, progressionId);
89
- t.is(_answer, answer);
90
- return Promise.resolve(getChoicesCorrection(slideRef));
91
- } });
92
- expectedActions = [
93
- {
94
- type: CORRECTION_FETCH_REQUEST,
95
- meta: {
96
- slideRef: freeTextSlide.universalRef
97
- }
98
- },
99
- {
100
- type: CORRECTION_FETCH_SUCCESS,
101
- payload: getChoicesCorrection(freeTextSlide.universalRef),
102
- meta: {
103
- slideRef: freeTextSlide.universalRef
104
- }
105
- }
106
- ];
107
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
108
- return [4 /*yield*/, dispatch(fetchCorrection)];
109
- case 1:
110
- _a.sent();
111
- return [2 /*return*/];
112
- }
113
- });
114
- }); });
115
- test('should dispatch CORRECTION_FETCH_FAILURE action when fetchCorrection fails', function (t) { return __awaiter(void 0, void 0, void 0, function () {
116
- var services, expectedActions, dispatch;
117
- return __generator(this, function (_a) {
118
- switch (_a.label) {
119
- case 0:
120
- t.plan(6);
121
- services = __assign(__assign({}, mockedServices), { fetchCorrection: function (slideRef, token, progressionId, _answer) {
122
- t.is(slideRef, freeTextSlide.universalRef);
123
- t.is(token, '1234');
124
- t.is(progression._id, progressionId);
125
- t.is(_answer, answer);
126
- return Promise.reject(new Error('unexpected'));
127
- } });
128
- expectedActions = [
129
- {
130
- type: CORRECTION_FETCH_REQUEST,
131
- meta: {
132
- slideRef: freeTextSlide.universalRef
133
- }
134
- },
135
- {
136
- type: CORRECTION_FETCH_FAILURE,
137
- meta: {
138
- slideRef: freeTextSlide.universalRef
139
- },
140
- payload: new Error('unexpected'),
141
- error: true
142
- }
143
- ];
144
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
145
- return [4 /*yield*/, dispatch(fetchCorrection)];
146
- case 1:
147
- _a.sent();
148
- return [2 /*return*/];
149
- }
150
- });
151
- }); });
@@ -1 +0,0 @@
1
- export {};
@@ -1,171 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import test from 'ava';
49
- import { fetchStartRank, fetchEndRank, RANK_FETCH_START_REQUEST, RANK_FETCH_START_SUCCESS, RANK_FETCH_START_FAILURE, RANK_FETCH_END_REQUEST, RANK_FETCH_END_SUCCESS, RANK_FETCH_END_FAILURE } from '../fetch-rank';
50
- import { services as mockedServices } from '../../../test/util/services.mock';
51
- import { createTestStore } from '../../test/create-test-store';
52
- var initialState = {
53
- data: {
54
- progression: null,
55
- slides: {},
56
- skills: [],
57
- token: '1234',
58
- corrections: {},
59
- rank: {}
60
- },
61
- ui: {
62
- currentSlideRef: '',
63
- navigation: [],
64
- answers: [],
65
- slide: {
66
- validateButton: false
67
- }
68
- }
69
- };
70
- test('should dispatch FETCH_START_SUCCESS action when fetchStartRank returns the start rank', function (t) { return __awaiter(void 0, void 0, void 0, function () {
71
- var services, expectedActions, dispatch;
72
- return __generator(this, function (_a) {
73
- switch (_a.label) {
74
- case 0:
75
- t.plan(3);
76
- services = __assign(__assign({}, mockedServices), { fetchRank: function (token) {
77
- t.is(token, '1234');
78
- return Promise.resolve({ rank: 93 });
79
- } });
80
- expectedActions = [
81
- { type: RANK_FETCH_START_REQUEST },
82
- {
83
- type: RANK_FETCH_START_SUCCESS,
84
- payload: { rank: 93 }
85
- }
86
- ];
87
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
88
- return [4 /*yield*/, dispatch(fetchStartRank)];
89
- case 1:
90
- _a.sent();
91
- return [2 /*return*/];
92
- }
93
- });
94
- }); });
95
- test('should dispatch FETCH_START_FAILURE action when fetchStartRank fails', function (t) { return __awaiter(void 0, void 0, void 0, function () {
96
- var services, expectedActions, dispatch;
97
- return __generator(this, function (_a) {
98
- switch (_a.label) {
99
- case 0:
100
- t.plan(3);
101
- services = __assign(__assign({}, mockedServices), { fetchRank: function (token) {
102
- t.is(token, '1234');
103
- return Promise.reject(new Error('unexpected'));
104
- } });
105
- expectedActions = [
106
- { type: RANK_FETCH_START_REQUEST },
107
- {
108
- type: RANK_FETCH_START_FAILURE,
109
- payload: new Error('unexpected'),
110
- error: true
111
- }
112
- ];
113
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
114
- return [4 /*yield*/, dispatch(fetchStartRank)];
115
- case 1:
116
- _a.sent();
117
- return [2 /*return*/];
118
- }
119
- });
120
- }); });
121
- test('should dispatch FETCH_END_SUCCESS action when fetchEndRank returns the end rank', function (t) { return __awaiter(void 0, void 0, void 0, function () {
122
- var services, expectedActions, dispatch;
123
- return __generator(this, function (_a) {
124
- switch (_a.label) {
125
- case 0:
126
- t.plan(3);
127
- services = __assign(__assign({}, mockedServices), { fetchRank: function (token) {
128
- t.is(token, '1234');
129
- return Promise.resolve({ rank: 93 });
130
- } });
131
- expectedActions = [
132
- { type: RANK_FETCH_END_REQUEST },
133
- {
134
- type: RANK_FETCH_END_SUCCESS,
135
- payload: { rank: 93 }
136
- }
137
- ];
138
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
139
- return [4 /*yield*/, dispatch(fetchEndRank)];
140
- case 1:
141
- _a.sent();
142
- return [2 /*return*/];
143
- }
144
- });
145
- }); });
146
- test('should dispatch FETCH_END_FAILURE action when fetchEndRank fails', function (t) { return __awaiter(void 0, void 0, void 0, function () {
147
- var services, expectedActions, dispatch;
148
- return __generator(this, function (_a) {
149
- switch (_a.label) {
150
- case 0:
151
- t.plan(3);
152
- services = __assign(__assign({}, mockedServices), { fetchRank: function (token) {
153
- t.is(token, '1234');
154
- return Promise.reject(new Error('unexpected'));
155
- } });
156
- expectedActions = [
157
- { type: RANK_FETCH_END_REQUEST },
158
- {
159
- type: RANK_FETCH_END_FAILURE,
160
- payload: new Error('unexpected'),
161
- error: true
162
- }
163
- ];
164
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
165
- return [4 /*yield*/, dispatch(fetchEndRank)];
166
- case 1:
167
- _a.sent();
168
- return [2 /*return*/];
169
- }
170
- });
171
- }); });
@@ -1 +0,0 @@
1
- export {};
@@ -1,120 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import test from 'ava';
49
- import { fetchSkills, SKILLS_FETCH_FAILURE, SKILLS_FETCH_REQUEST, SKILLS_FETCH_SUCCESS } from '../fetch-skills';
50
- import { services as mockedServices } from '../../../test/util/services.mock';
51
- import { createTestStore } from '../../test/create-test-store';
52
- var initialState = {
53
- data: {
54
- progression: null,
55
- slides: {},
56
- skills: [],
57
- token: '1234',
58
- corrections: {},
59
- rank: {}
60
- },
61
- ui: {
62
- currentSlideRef: '',
63
- navigation: [],
64
- answers: [],
65
- slide: {
66
- validateButton: false
67
- }
68
- }
69
- };
70
- test('should dispatch SKILLS_FETCH_SUCCESS actions when fetchSkills returns a list of skills', function (t) { return __awaiter(void 0, void 0, void 0, function () {
71
- var services, expectedActions, dispatch;
72
- return __generator(this, function (_a) {
73
- switch (_a.label) {
74
- case 0:
75
- t.plan(3);
76
- services = __assign(__assign({}, mockedServices), { fetchSkills: function (token) {
77
- t.is(token, '1234');
78
- return Promise.resolve([]);
79
- } });
80
- expectedActions = [
81
- { type: SKILLS_FETCH_REQUEST },
82
- {
83
- type: SKILLS_FETCH_SUCCESS,
84
- payload: []
85
- }
86
- ];
87
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
88
- return [4 /*yield*/, dispatch(fetchSkills)];
89
- case 1:
90
- _a.sent();
91
- return [2 /*return*/];
92
- }
93
- });
94
- }); });
95
- test('should dispatch SKILLS_FETCH_FAILURE action when fetchSkills fails', function (t) { return __awaiter(void 0, void 0, void 0, function () {
96
- var services, expectedActions, dispatch;
97
- return __generator(this, function (_a) {
98
- switch (_a.label) {
99
- case 0:
100
- t.plan(3);
101
- services = __assign(__assign({}, mockedServices), { fetchSkills: function (token) {
102
- t.is(token, '1234');
103
- return Promise.reject(new Error('unexpected'));
104
- } });
105
- expectedActions = [
106
- { type: SKILLS_FETCH_REQUEST },
107
- {
108
- type: SKILLS_FETCH_FAILURE,
109
- payload: new Error('unexpected'),
110
- error: true
111
- }
112
- ];
113
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
114
- return [4 /*yield*/, dispatch(fetchSkills)];
115
- case 1:
116
- _a.sent();
117
- return [2 /*return*/];
118
- }
119
- });
120
- }); });
@@ -1 +0,0 @@
1
- export {};
@@ -1,127 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import test from 'ava';
49
- import { fetchSlide, SLIDE_FETCH_FAILURE, SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../fetch-slide';
50
- import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
51
- import { services as mockedServices } from '../../../test/util/services.mock';
52
- import { SET_CURRENT_SLIDE } from '../../ui/slides';
53
- import { createTestStore } from '../../test/create-test-store';
54
- var initialState = {
55
- data: {
56
- progression: null,
57
- slides: {},
58
- skills: [],
59
- token: '1234',
60
- corrections: {},
61
- rank: {}
62
- },
63
- ui: {
64
- currentSlideRef: '',
65
- navigation: [],
66
- answers: [],
67
- slide: {
68
- validateButton: false
69
- }
70
- }
71
- };
72
- test('should dispatch FETCH_SUCCESS and SET_CURRENT_SLIDE actions when fetchSlide return a slide', function (t) { return __awaiter(void 0, void 0, void 0, function () {
73
- var services, expectedActions, dispatch;
74
- return __generator(this, function (_a) {
75
- switch (_a.label) {
76
- case 0:
77
- t.plan(5);
78
- services = __assign(__assign({}, mockedServices), { fetchSlide: function (slideRef, token) {
79
- t.is(token, '1234');
80
- t.is(slideRef, 'sli_VJYjJnJhg');
81
- return Promise.resolve(freeTextSlide);
82
- } });
83
- expectedActions = [
84
- { type: SLIDE_FETCH_REQUEST, meta: { slideRef: 'sli_VJYjJnJhg' } },
85
- {
86
- type: SLIDE_FETCH_SUCCESS,
87
- meta: { slideRef: 'sli_VJYjJnJhg' },
88
- payload: freeTextSlide
89
- },
90
- { type: SET_CURRENT_SLIDE, payload: freeTextSlide }
91
- ];
92
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
93
- return [4 /*yield*/, dispatch(fetchSlide('sli_VJYjJnJhg'))];
94
- case 1:
95
- _a.sent();
96
- return [2 /*return*/];
97
- }
98
- });
99
- }); });
100
- test('should dispatch SLIDE_FETCH_FAILURE action when fetchSlide fails', function (t) { return __awaiter(void 0, void 0, void 0, function () {
101
- var services, expectedActions, dispatch;
102
- return __generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0:
105
- t.plan(4);
106
- services = __assign(__assign({}, mockedServices), { fetchSlide: function (slideRef, token) {
107
- t.is(token, '1234');
108
- t.is(slideRef, 'slide_ref');
109
- return Promise.reject(new Error('error'));
110
- } });
111
- expectedActions = [
112
- { type: SLIDE_FETCH_REQUEST, meta: { slideRef: 'slide_ref' } },
113
- {
114
- type: SLIDE_FETCH_FAILURE,
115
- meta: { slideRef: 'slide_ref' },
116
- payload: new Error('error'),
117
- error: true
118
- }
119
- ];
120
- dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
121
- return [4 /*yield*/, dispatch(fetchSlide('slide_ref'))];
122
- case 1:
123
- _a.sent();
124
- return [2 /*return*/];
125
- }
126
- });
127
- }); });
@@ -1 +0,0 @@
1
- export {};