@coorpacademy/app-review 0.1.14 → 0.1.16

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 (295) hide show
  1. package/es/actions/api/fetch-skills.d.ts +4 -6
  2. package/es/actions/api/fetch-skills.js +7 -4
  3. package/es/actions/api/fetch-slide.d.ts +14 -7
  4. package/es/actions/api/fetch-slide.js +27 -4
  5. package/es/actions/api/post-progression.d.ts +4 -6
  6. package/es/actions/api/post-progression.js +13 -9
  7. package/es/actions/api/test/create-test-store.d.ts +5 -0
  8. package/es/actions/api/test/create-test-store.js +16 -0
  9. package/es/actions/api/test/fetch-skills.test.js +54 -0
  10. package/es/actions/api/test/fetch-slide.test.js +61 -0
  11. package/es/actions/api/test/post-progression.test.js +102 -0
  12. package/es/actions/index.d.ts +1 -10
  13. package/es/actions/ui/answers.d.ts +7 -0
  14. package/es/actions/ui/answers.js +7 -0
  15. package/es/actions/ui/is-fetching.js +0 -2
  16. package/es/actions/ui/slides.d.ts +26 -0
  17. package/es/actions/ui/slides.js +9 -0
  18. package/es/common/index.d.ts +3 -1
  19. package/es/common/index.js +3 -1
  20. package/es/fixtures/qcm-slide.d.ts +2 -2
  21. package/es/fixtures/temp-fixture.d.ts +2 -2
  22. package/es/index.js +22 -92
  23. package/es/reducers/data/index.d.ts +2 -2
  24. package/es/reducers/data/progression.d.ts +3 -16
  25. package/es/reducers/data/progression.js +3 -22
  26. package/es/reducers/data/slides.d.ts +5 -6
  27. package/es/reducers/data/slides.js +9 -108
  28. package/es/reducers/data/test/progression.test.js +38 -0
  29. package/es/reducers/data/test/skills.test.js +12 -0
  30. package/es/reducers/data/test/slides.test.js +20 -0
  31. package/es/reducers/data/test/token.test.js +11 -0
  32. package/es/reducers/index.d.ts +3 -4
  33. package/es/reducers/ui/answers.d.ts +4 -0
  34. package/es/reducers/ui/{review-status.js → answers.js} +3 -3
  35. package/es/reducers/ui/current-slide-ref.d.ts +4 -0
  36. package/es/reducers/ui/current-slide-ref.js +13 -0
  37. package/es/reducers/ui/index.d.ts +7 -10
  38. package/es/reducers/ui/index.js +4 -6
  39. package/es/reducers/ui/test/answers.test.js +11 -0
  40. package/es/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
  41. package/es/reducers/ui/test/current-slide-ref.test.js +12 -0
  42. package/es/reducers/ui/test/navigation.test.d.ts +1 -0
  43. package/es/reducers/ui/test/navigation.test.js +15 -0
  44. package/es/services/fetch-slide.js +1 -1
  45. package/es/services/index.js +3 -1
  46. package/es/services/post-answer.d.ts +2 -0
  47. package/es/services/post-answer.js +18 -0
  48. package/es/services/test/fetch-slide.test.d.ts +1 -0
  49. package/es/services/test/fetch-slide.test.js +22 -0
  50. package/es/services/test/post-answer.test.d.ts +1 -0
  51. package/es/services/test/post-answer.test.js +57 -0
  52. package/es/services/test/post-progression.test.js +14 -4
  53. package/es/test/util/services.mock.js +46 -4
  54. package/es/types/common.d.ts +61 -30
  55. package/es/types/common.js +0 -5
  56. package/es/types/slides.d.ts +0 -4
  57. package/{lib/types/views/skills.d.ts → es/views/skills/index.d.ts} +2 -0
  58. package/es/views/skills/index.js +25 -0
  59. package/es/views/slides/index.d.ts +79 -0
  60. package/es/views/slides/index.js +151 -0
  61. package/es/views/slides/map-api-slide-to-ui.d.ts +8 -0
  62. package/es/views/slides/map-api-slide-to-ui.js +172 -0
  63. package/es/views/slides/test/fixtures/free-text.d.ts +3 -0
  64. package/es/views/slides/test/fixtures/free-text.js +38 -0
  65. package/es/views/slides/test/fixtures/qcm-drag.d.ts +3 -0
  66. package/es/views/slides/test/fixtures/qcm-drag.js +108 -0
  67. package/es/views/slides/test/fixtures/qcm-graphic.d.ts +3 -0
  68. package/es/views/slides/test/fixtures/qcm-graphic.js +88 -0
  69. package/es/views/slides/test/fixtures/qcm.d.ts +3 -0
  70. package/es/{helpers → views/slides}/test/fixtures/qcm.js +37 -27
  71. package/es/views/slides/test/fixtures/select-template.d.ts +3 -0
  72. package/es/views/slides/test/fixtures/select-template.js +92 -0
  73. package/es/views/slides/test/fixtures/slider.d.ts +3 -0
  74. package/es/views/slides/test/fixtures/slider.js +36 -0
  75. package/es/views/slides/test/fixtures/text-template.d.ts +3 -0
  76. package/es/{helpers → views/slides}/test/fixtures/text-template.js +21 -11
  77. package/es/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
  78. package/es/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
  79. package/lib/actions/api/fetch-skills.d.ts +4 -6
  80. package/lib/actions/api/fetch-skills.js +55 -7
  81. package/lib/actions/api/fetch-slide.d.ts +14 -7
  82. package/lib/actions/api/fetch-slide.js +75 -7
  83. package/lib/actions/api/post-progression.d.ts +4 -6
  84. package/lib/actions/api/post-progression.js +63 -10
  85. package/lib/actions/api/test/create-test-store.d.ts +5 -0
  86. package/lib/actions/api/test/create-test-store.js +18 -0
  87. package/lib/actions/api/test/fetch-skills.test.d.ts +1 -0
  88. package/lib/actions/api/test/fetch-skills.test.js +113 -0
  89. package/lib/actions/api/test/fetch-slide.test.d.ts +1 -0
  90. package/lib/actions/api/test/fetch-slide.test.js +120 -0
  91. package/lib/actions/api/test/post-progression.test.d.ts +1 -0
  92. package/lib/actions/api/test/post-progression.test.js +160 -0
  93. package/lib/actions/index.d.ts +1 -10
  94. package/lib/actions/ui/answers.d.ts +7 -0
  95. package/lib/actions/ui/answers.js +9 -0
  96. package/lib/actions/ui/is-fetching.js +0 -2
  97. package/lib/actions/ui/slides.d.ts +26 -0
  98. package/lib/actions/ui/slides.js +9 -0
  99. package/lib/common/index.d.ts +3 -1
  100. package/lib/common/index.js +3 -1
  101. package/lib/fixtures/qcm-slide.d.ts +2 -2
  102. package/lib/fixtures/temp-fixture.d.ts +2 -2
  103. package/lib/index.js +33 -94
  104. package/lib/reducers/data/index.d.ts +2 -2
  105. package/lib/reducers/data/progression.d.ts +3 -16
  106. package/lib/reducers/data/progression.js +3 -22
  107. package/lib/reducers/data/slides.d.ts +5 -6
  108. package/lib/reducers/data/slides.js +9 -114
  109. package/lib/reducers/data/test/progression.test.d.ts +1 -0
  110. package/lib/reducers/data/test/progression.test.js +38 -0
  111. package/lib/reducers/data/test/skills.test.d.ts +1 -0
  112. package/lib/reducers/data/test/skills.test.js +12 -0
  113. package/lib/reducers/data/test/slides.test.d.ts +1 -0
  114. package/lib/reducers/data/test/slides.test.js +20 -0
  115. package/lib/reducers/data/test/token.test.d.ts +1 -0
  116. package/lib/reducers/data/test/token.test.js +11 -0
  117. package/lib/reducers/index.d.ts +3 -4
  118. package/lib/reducers/ui/answers.d.ts +4 -0
  119. package/lib/reducers/ui/{review-status.js → answers.js} +3 -3
  120. package/lib/reducers/ui/current-slide-ref.d.ts +4 -0
  121. package/lib/reducers/ui/current-slide-ref.js +14 -0
  122. package/lib/reducers/ui/index.d.ts +7 -10
  123. package/lib/reducers/ui/index.js +4 -6
  124. package/lib/reducers/ui/test/answers.test.d.ts +1 -0
  125. package/lib/reducers/ui/test/answers.test.js +11 -0
  126. package/lib/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
  127. package/lib/reducers/ui/test/current-slide-ref.test.js +12 -0
  128. package/lib/reducers/ui/test/navigation.test.d.ts +1 -0
  129. package/lib/reducers/ui/test/navigation.test.js +15 -0
  130. package/lib/services/fetch-slide.js +1 -1
  131. package/lib/services/index.js +3 -1
  132. package/lib/services/post-answer.d.ts +2 -0
  133. package/lib/services/post-answer.js +62 -0
  134. package/lib/services/test/fetch-slide.test.d.ts +1 -0
  135. package/lib/services/test/fetch-slide.test.js +76 -0
  136. package/lib/services/test/post-answer.test.d.ts +1 -0
  137. package/lib/services/test/post-answer.test.js +111 -0
  138. package/lib/services/test/post-progression.test.js +14 -4
  139. package/lib/test/util/services.mock.js +46 -4
  140. package/lib/types/common.d.ts +61 -30
  141. package/lib/types/common.js +0 -5
  142. package/lib/types/slides.d.ts +0 -4
  143. package/{es/types/views/skills.d.ts → lib/views/skills/index.d.ts} +2 -0
  144. package/lib/views/skills/index.js +25 -0
  145. package/lib/views/slides/index.d.ts +79 -0
  146. package/lib/views/slides/index.js +155 -0
  147. package/lib/views/slides/map-api-slide-to-ui.d.ts +8 -0
  148. package/lib/views/slides/map-api-slide-to-ui.js +178 -0
  149. package/lib/views/slides/test/fixtures/free-text.d.ts +3 -0
  150. package/lib/views/slides/test/fixtures/free-text.js +38 -0
  151. package/lib/views/slides/test/fixtures/qcm-drag.d.ts +3 -0
  152. package/lib/views/slides/test/fixtures/qcm-drag.js +108 -0
  153. package/lib/views/slides/test/fixtures/qcm-graphic.d.ts +3 -0
  154. package/lib/views/slides/test/fixtures/qcm-graphic.js +88 -0
  155. package/lib/views/slides/test/fixtures/qcm.d.ts +3 -0
  156. package/lib/{helpers → views/slides}/test/fixtures/qcm.js +37 -27
  157. package/lib/views/slides/test/fixtures/select-template.d.ts +3 -0
  158. package/lib/views/slides/test/fixtures/select-template.js +92 -0
  159. package/lib/views/slides/test/fixtures/slider.d.ts +3 -0
  160. package/lib/views/slides/test/fixtures/slider.js +36 -0
  161. package/lib/views/slides/test/fixtures/text-template.d.ts +3 -0
  162. package/lib/{helpers → views/slides}/test/fixtures/text-template.js +21 -11
  163. package/lib/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
  164. package/lib/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
  165. package/package.json +4 -3
  166. package/src/actions/api/fetch-skills.ts +12 -12
  167. package/src/actions/api/fetch-slide.ts +38 -13
  168. package/src/actions/api/post-progression.ts +18 -22
  169. package/src/actions/api/test/create-test-store.ts +25 -0
  170. package/src/actions/api/test/fetch-skills.test.ts +70 -0
  171. package/src/actions/api/test/fetch-slide.test.ts +77 -0
  172. package/src/actions/api/test/post-progression.test.ts +119 -0
  173. package/src/actions/index.ts +1 -10
  174. package/src/actions/ui/answers.ts +16 -0
  175. package/src/actions/ui/is-fetching.ts +0 -6
  176. package/src/actions/ui/slides.ts +35 -0
  177. package/src/common/index.ts +7 -1
  178. package/src/fixtures/qcm-slide.ts +2 -2
  179. package/src/fixtures/temp-fixture.ts +2 -2
  180. package/src/index.tsx +26 -110
  181. package/src/reducers/data/index.ts +1 -1
  182. package/src/reducers/data/progression.ts +5 -40
  183. package/src/reducers/data/slides.ts +17 -125
  184. package/src/reducers/data/test/progression.test.ts +42 -0
  185. package/src/reducers/data/test/skills.test.ts +14 -0
  186. package/src/reducers/data/test/slides.test.ts +26 -0
  187. package/src/reducers/data/test/token.test.ts +13 -0
  188. package/src/reducers/ui/answers.ts +19 -0
  189. package/src/reducers/ui/current-slide-ref.ts +19 -0
  190. package/src/reducers/ui/index.ts +6 -9
  191. package/src/reducers/ui/test/answers.test.ts +13 -0
  192. package/src/reducers/ui/test/current-slide-ref.test.ts +14 -0
  193. package/src/reducers/ui/test/navigation.test.ts +19 -0
  194. package/src/services/fetch-slide.ts +1 -1
  195. package/src/services/index.ts +3 -1
  196. package/src/services/post-answer.ts +27 -0
  197. package/src/services/test/fetch-slide.test.ts +30 -0
  198. package/src/services/test/post-answer.test.ts +68 -0
  199. package/src/services/test/post-progression.test.ts +14 -4
  200. package/src/test/util/services.mock.ts +46 -4
  201. package/src/types/common.ts +77 -40
  202. package/src/types/slides.ts +0 -5
  203. package/src/views/skills/index.ts +56 -0
  204. package/src/views/slides/index.ts +251 -0
  205. package/src/views/slides/map-api-slide-to-ui.ts +251 -0
  206. package/src/views/slides/test/fixtures/free-text.ts +43 -0
  207. package/src/views/slides/test/fixtures/qcm-drag.ts +111 -0
  208. package/src/views/slides/test/fixtures/qcm-graphic.ts +94 -0
  209. package/src/{helpers → views/slides}/test/fixtures/qcm.ts +43 -33
  210. package/src/views/slides/test/fixtures/select-template.ts +98 -0
  211. package/src/views/slides/test/fixtures/slider.ts +41 -0
  212. package/src/{helpers → views/slides}/test/fixtures/text-template.ts +23 -14
  213. package/src/{helpers → views/slides}/test/map-api-slide-to-ui.test.ts +22 -20
  214. package/es/actions/data/slides.d.ts +0 -37
  215. package/es/actions/data/slides.js +0 -16
  216. package/es/actions/ui/finished-slides.d.ts +0 -10
  217. package/es/actions/ui/finished-slides.js +0 -8
  218. package/es/actions/ui/review-status.d.ts +0 -7
  219. package/es/actions/ui/review-status.js +0 -7
  220. package/es/actions/ui/step-items.d.ts +0 -24
  221. package/es/actions/ui/step-items.js +0 -11
  222. package/es/helpers/map-api-slide-to-ui.d.ts +0 -8
  223. package/es/helpers/map-api-slide-to-ui.js +0 -175
  224. package/es/helpers/test/fixtures/free-text.d.ts +0 -4
  225. package/es/helpers/test/fixtures/free-text.js +0 -24
  226. package/es/helpers/test/fixtures/qcm-drag.d.ts +0 -4
  227. package/es/helpers/test/fixtures/qcm-drag.js +0 -106
  228. package/es/helpers/test/fixtures/qcm-graphic.d.ts +0 -4
  229. package/es/helpers/test/fixtures/qcm-graphic.js +0 -70
  230. package/es/helpers/test/fixtures/qcm.d.ts +0 -4
  231. package/es/helpers/test/fixtures/select-template.d.ts +0 -4
  232. package/es/helpers/test/fixtures/select-template.js +0 -88
  233. package/es/helpers/test/fixtures/slider.d.ts +0 -4
  234. package/es/helpers/test/fixtures/slider.js +0 -27
  235. package/es/helpers/test/fixtures/text-template.d.ts +0 -4
  236. package/es/reducers/ui/finished-slides.d.ts +0 -7
  237. package/es/reducers/ui/finished-slides.js +0 -33
  238. package/es/reducers/ui/review-status.d.ts +0 -4
  239. package/es/reducers/ui/step-items.d.ts +0 -14
  240. package/es/reducers/ui/step-items.js +0 -74
  241. package/es/types/ui-progression.d.ts +0 -10
  242. package/es/types/views/slides.d.ts +0 -60
  243. package/lib/actions/data/slides.d.ts +0 -37
  244. package/lib/actions/data/slides.js +0 -16
  245. package/lib/actions/ui/finished-slides.d.ts +0 -10
  246. package/lib/actions/ui/finished-slides.js +0 -8
  247. package/lib/actions/ui/review-status.d.ts +0 -7
  248. package/lib/actions/ui/review-status.js +0 -7
  249. package/lib/actions/ui/step-items.d.ts +0 -24
  250. package/lib/actions/ui/step-items.js +0 -11
  251. package/lib/helpers/map-api-slide-to-ui.d.ts +0 -8
  252. package/lib/helpers/map-api-slide-to-ui.js +0 -181
  253. package/lib/helpers/test/fixtures/free-text.d.ts +0 -4
  254. package/lib/helpers/test/fixtures/free-text.js +0 -24
  255. package/lib/helpers/test/fixtures/qcm-drag.d.ts +0 -4
  256. package/lib/helpers/test/fixtures/qcm-drag.js +0 -106
  257. package/lib/helpers/test/fixtures/qcm-graphic.d.ts +0 -4
  258. package/lib/helpers/test/fixtures/qcm-graphic.js +0 -70
  259. package/lib/helpers/test/fixtures/qcm.d.ts +0 -4
  260. package/lib/helpers/test/fixtures/select-template.d.ts +0 -4
  261. package/lib/helpers/test/fixtures/select-template.js +0 -88
  262. package/lib/helpers/test/fixtures/slider.d.ts +0 -4
  263. package/lib/helpers/test/fixtures/slider.js +0 -27
  264. package/lib/helpers/test/fixtures/text-template.d.ts +0 -4
  265. package/lib/reducers/ui/finished-slides.d.ts +0 -7
  266. package/lib/reducers/ui/finished-slides.js +0 -45
  267. package/lib/reducers/ui/review-status.d.ts +0 -4
  268. package/lib/reducers/ui/step-items.d.ts +0 -14
  269. package/lib/reducers/ui/step-items.js +0 -86
  270. package/lib/types/ui-progression.d.ts +0 -10
  271. package/lib/types/views/slides.d.ts +0 -60
  272. package/src/actions/data/slides.ts +0 -65
  273. package/src/actions/ui/finished-slides.ts +0 -21
  274. package/src/actions/ui/review-status.ts +0 -19
  275. package/src/actions/ui/step-items.ts +0 -45
  276. package/src/helpers/map-api-slide-to-ui.ts +0 -253
  277. package/src/helpers/test/fixtures/free-text.ts +0 -28
  278. package/src/helpers/test/fixtures/qcm-drag.ts +0 -110
  279. package/src/helpers/test/fixtures/qcm-graphic.ts +0 -74
  280. package/src/helpers/test/fixtures/select-template.ts +0 -92
  281. package/src/helpers/test/fixtures/slider.ts +0 -31
  282. package/src/reducers/ui/finished-slides.ts +0 -52
  283. package/src/reducers/ui/review-status.ts +0 -19
  284. package/src/reducers/ui/step-items.ts +0 -116
  285. package/src/types/ui-progression.ts +0 -25
  286. package/src/types/views/skills.ts +0 -27
  287. package/src/types/views/slides.ts +0 -65
  288. /package/es/{helpers/test/map-api-slide-to-ui.test.d.ts → actions/api/test/fetch-skills.test.d.ts} +0 -0
  289. /package/es/{types/ui-progression.js → actions/api/test/fetch-slide.test.d.ts} +0 -0
  290. /package/es/{types/views/skills.js → actions/api/test/post-progression.test.d.ts} +0 -0
  291. /package/es/{types/views/slides.js → reducers/data/test/progression.test.d.ts} +0 -0
  292. /package/{lib/helpers/test/map-api-slide-to-ui.test.d.ts → es/reducers/data/test/skills.test.d.ts} +0 -0
  293. /package/{lib/types/ui-progression.js → es/reducers/data/test/slides.test.d.ts} +0 -0
  294. /package/{lib/types/views/skills.js → es/reducers/data/test/token.test.d.ts} +0 -0
  295. /package/{lib/types/views/slides.js → es/reducers/ui/test/answers.test.d.ts} +0 -0
@@ -1,5 +1,4 @@
1
- import { getOr } from 'lodash/fp';
2
- import { VALIDATE_SLIDE } from '../../actions/data/slides';
1
+ import { VALIDATE_SLIDE } from '../../actions/ui/slides';
3
2
  import { POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
4
3
  var reducer = function (
5
4
  // eslint-disable-next-line default-param-last
@@ -7,25 +6,8 @@ state, action) {
7
6
  if (state === void 0) { state = null; }
8
7
  switch (action.type) {
9
8
  case VALIDATE_SLIDE: {
10
- var previousSlideNumber = getOr(-1, 'slideNumber', state);
11
- // hard coded for now
12
- // TODO: fix on VALIDATE ticket
13
- return {
14
- _id: '1234',
15
- // virtual field
16
- slideNumber: previousSlideNumber + 1,
17
- state: {
18
- pendingSlides: [],
19
- step: {
20
- current: Number.NaN
21
- },
22
- isCorrect: true,
23
- nextContent: {
24
- ref: 'sli_V1gKpYYZ2',
25
- type: 'slide'
26
- }
27
- }
28
- };
9
+ // TODO: fix on VALIDATE ticket -> launch a POST PROGRESSION
10
+ return state;
29
11
  }
30
12
  case POST_PROGRESSION_SUCCESS: {
31
13
  var progression = action.payload;
@@ -35,5 +17,4 @@ state, action) {
35
17
  return state;
36
18
  }
37
19
  };
38
- // -----------------------------------------------------------------------------
39
20
  export default reducer;
@@ -1,9 +1,8 @@
1
- import { SlidesAction } from '../../actions/data/slides';
2
- import { Slide } from '../../types/common';
3
- export declare type SlidesState = {
4
- slideNumbers: number[];
5
- [key: number]: Slide;
6
- };
1
+ import { ValidateSlide } from '../../actions/ui/slides';
2
+ import { ReceivedSlide, FetchSlide } from '../../actions/api/fetch-slide';
3
+ import { SlideFromAPI } from '../../types/common';
4
+ export declare type SlidesAction = FetchSlide | ReceivedSlide | ValidateSlide;
5
+ export declare type SlidesState = Record<string, SlideFromAPI>;
7
6
  export declare const initialState: SlidesState;
8
7
  declare const reducer: (state: SlidesState | undefined, action: SlidesAction) => SlidesState;
9
8
  export default reducer;
@@ -1,125 +1,20 @@
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 map from 'lodash/fp/map';
13
- import { UPDATE_SLIDES_ON_NEXT, UPDATE_SLIDES_ON_VALIDATION } from '../../actions/data/slides';
14
- import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../../common';
15
- import { slide as qcmSlide } from '../../fixtures/qcm-slide';
16
- import { SLIDE_FETCH_SUCCESS } from '../../actions/api/fetch-slide';
17
- var getInitialState = function () {
18
- var state = {
19
- slideNumbers: slideNumbers
20
- };
21
- // eslint-disable-next-line fp/no-loops
22
- for (var index = 0; index < TOTAL_SLIDES_STACK; index++) {
23
- state[index] = { hidden: false, position: index };
24
- }
25
- return state;
26
- };
27
- export var initialState = getInitialState();
28
- // -----------------------------------------------------------------------------
29
- var setFirstSlide = function (state, slide) {
30
- var _state = {
31
- slideNumbers: slideNumbers
32
- };
33
- // eslint-disable-next-line lodash-fp/no-unused-result
34
- map(function (index) {
35
- var previousValue = state[index];
36
- // Only update the 1st one
37
- var content = index === 0 ? __assign(__assign({}, previousValue), slide) : __assign({}, previousValue);
38
- _state[index] = __assign({}, content);
39
- }, state.slideNumbers);
40
- return _state;
41
- };
42
- // ||-------> Handles the updates of a given slide on validation,
43
- // & then updates de remaining slides if this given change should impact their content
44
- var stateUpdateOnValidation = function (state, payload) {
45
- var slideNumber = payload.slideNumber, newSlideContent = payload.newSlideContent, numberOfFinishedSlides = payload.numberOfFinishedSlides, nextContent = payload.nextContent;
46
- var _state = {
47
- slideNumbers: slideNumbers
48
- };
49
- // eslint-disable-next-line lodash-fp/no-unused-result
50
- map(function (index) {
51
- var previousValue = state[index];
52
- // the current slide
53
- if (index === slideNumber) {
54
- // only one slide remaining, presets the next value
55
- if (numberOfFinishedSlides === HIGHEST_INDEX) {
56
- _state[index] = __assign(__assign({}, previousValue), { nextContent: nextContent, position: newSlideContent.position, isCorrect: newSlideContent.isCorrect });
57
- }
58
- else
59
- _state[slideNumber] = __assign(__assign({}, previousValue), newSlideContent);
60
- }
61
- else {
62
- // updates the rest of the slides here
63
- var hidden = previousValue.hidden, position = previousValue.position;
64
- _state[index] = __assign(__assign({}, nextContent), { endReview: newSlideContent.endReview, hidden: hidden, position: position });
65
- }
66
- }, state.slideNumbers);
67
- return _state;
68
- };
69
- // ||-------> Handles the updates of a given slide on correction popin's next click,
70
- // & then updates de remaining slides (updates position to trigger animations)
71
- var stateUpdateOnNext = function (state, payload) {
72
- var slideNumber = payload.slideNumber, newSlideContent = payload.newSlideContent, numberOfFinishedSlides = payload.numberOfFinishedSlides;
73
- var _state = {
74
- slideNumbers: slideNumbers
75
- };
76
- // eslint-disable-next-line lodash-fp/no-unused-result
77
- map(function (index) {
78
- var previousValue = state[index];
79
- // the current slide
80
- if (index === slideNumber) {
81
- // when there is only one slide remaining, updates the slide value
82
- if (numberOfFinishedSlides === HIGHEST_INDEX && previousValue.nextContent) {
83
- _state[index] = __assign(__assign({}, previousValue.nextContent), { position: previousValue.position });
84
- }
85
- else
86
- _state[slideNumber] = newSlideContent;
87
- }
88
- else {
89
- // updates the rest of the slides here
90
- var hidden = previousValue.hidden, position = previousValue.position, answerUI = previousValue.answerUI, questionText = previousValue.questionText;
91
- _state[index] = {
92
- hidden: hidden,
93
- position: position - 1,
94
- answerUI: answerUI,
95
- questionText: questionText,
96
- endReview: newSlideContent.endReview
97
- };
98
- }
99
- }, state.slideNumbers);
100
- return _state;
101
- };
102
- // -----------------------------------------------------------------------------
1
+ import set from 'lodash/fp/set';
2
+ import { SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../../actions/api/fetch-slide';
3
+ export var initialState = {};
103
4
  // eslint-disable-next-line default-param-last
104
5
  var reducer = function (state, action) {
105
6
  if (state === void 0) { state = initialState; }
106
7
  switch (action.type) {
107
- case SLIDE_FETCH_SUCCESS: {
108
- // TODO: An intermediate slide transform is needed here (or in fetchSlide)
109
- // const apiSlide = action.payload;
110
- // apiSlide adapt to uiSlide
111
- var uiSlide = qcmSlide;
112
- return setFirstSlide(state, uiSlide);
113
- }
114
- case UPDATE_SLIDES_ON_VALIDATION: {
115
- return stateUpdateOnValidation(state, action.payload);
8
+ case SLIDE_FETCH_REQUEST: {
9
+ var meta = action.meta;
10
+ return set(meta.slideRef, null, state);
116
11
  }
117
- case UPDATE_SLIDES_ON_NEXT: {
118
- return stateUpdateOnNext(state, action.payload);
12
+ case SLIDE_FETCH_SUCCESS: {
13
+ var slide = action.payload;
14
+ return set(slide.id, slide, state);
119
15
  }
120
16
  default:
121
17
  return state;
122
18
  }
123
19
  };
124
- // -----------------------------------------------------------------------------
125
20
  export default reducer;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ import test from 'ava';
2
+ import reducer from '../progression';
3
+ import { POST_PROGRESSION_SUCCESS } from '../../../actions/api/post-progression';
4
+ test('should have inital value', function (t) {
5
+ var state = reducer(undefined, {});
6
+ t.is(state, null);
7
+ });
8
+ test('should set the value of POST_PROGRESSION_SUCCESS action', function (t) {
9
+ var progression = {
10
+ _id: '62b1d1087aa12f00253f40ee',
11
+ content: {
12
+ ref: '_skill-ref',
13
+ type: 'skill'
14
+ },
15
+ engine: {
16
+ ref: 'review'
17
+ },
18
+ state: {
19
+ allAnswers: [],
20
+ isCorrect: true,
21
+ nextContent: {
22
+ ref: 'sli_N1XACJobn',
23
+ type: 'slide'
24
+ },
25
+ pendingSlides: [],
26
+ slides: [],
27
+ step: {
28
+ current: 1
29
+ },
30
+ stars: 0
31
+ }
32
+ };
33
+ var state = reducer(null, {
34
+ type: POST_PROGRESSION_SUCCESS,
35
+ payload: progression
36
+ });
37
+ t.deepEqual(state, progression);
38
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import test from 'ava';
2
+ import reducer from '../skills';
3
+ import { SKILLS_FETCH_SUCCESS } from '../../../actions/api/fetch-skills';
4
+ test('should have inital value', function (t) {
5
+ var state = reducer(undefined, {});
6
+ t.deepEqual(state, []);
7
+ });
8
+ test('should set the value of SKILLS_FETCH_SUCCESS action', function (t) {
9
+ var skills = [{ skillRef: 'skill', name: 'skill name', slidesToReview: 5, custom: false }];
10
+ var state = reducer([], { type: SKILLS_FETCH_SUCCESS, payload: skills });
11
+ t.deepEqual(state, skills);
12
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import test from 'ava';
2
+ import reducer from '../slides';
3
+ import { SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../../../actions/api/fetch-slide';
4
+ import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
5
+ test('should have inital value', function (t) {
6
+ var state = reducer(undefined, {});
7
+ t.deepEqual(state, {});
8
+ });
9
+ test('should set the value of SLIDE_FETCH_REQUEST action', function (t) {
10
+ var state = reducer({}, { type: SLIDE_FETCH_REQUEST, meta: { slideRef: 'slideRef' } });
11
+ t.deepEqual(state, {
12
+ slideRef: null
13
+ });
14
+ });
15
+ test('should set the value of SLIDE_FETCH_SUCCESS action', function (t) {
16
+ var state = reducer({}, { type: SLIDE_FETCH_SUCCESS, payload: freeTextSlide, meta: { slideRef: 'sli_VJYjJnJhg' } });
17
+ t.deepEqual(state, {
18
+ sli_VJYjJnJhg: freeTextSlide
19
+ });
20
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import test from 'ava';
2
+ import reducer from '../token';
3
+ import { STORE_TOKEN } from '../../../actions/data/token';
4
+ test('should have inital value', function (t) {
5
+ var state = reducer(undefined, {});
6
+ t.is(state, null);
7
+ });
8
+ test('should set the value of STORE_TOKEN action', function (t) {
9
+ var state = reducer(null, { type: STORE_TOKEN, payload: 'token' });
10
+ t.is(state, 'token');
11
+ });
@@ -12,10 +12,9 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
12
12
  token: import("./data/token").TokenState;
13
13
  }>;
14
14
  ui: import("redux").CombinedState<{
15
- finishedSlides: import("./ui/finished-slides").FinishedSlidesState;
15
+ currentSlideRef: string;
16
16
  navigation: import("./ui/navigation").NavigationState;
17
- reviewStatus: import("./ui/review-status").ReviewStatusState;
18
- stepItems: import("./ui/step-items").StepItemsState;
17
+ answers: import("./ui/answers").AnswerState;
19
18
  }>;
20
- }>, import("../actions/data/slides").ValidateSlide | import("../actions/data/slides").SlidesAction | import("../actions/api/post-progression").ReceiveProgression | import("../actions/api/fetch-skills").ReceivedSkills | import("../actions/data/token").StoreToken | import("../actions/ui/finished-slides").UpdateFinishedSlides | import("../actions/ui/navigation").NavigateTo | import("../actions/ui/navigation").NavigateBack | import("../actions/ui/review-status").UpdateReviewStatus | import("../actions/ui/step-items").StepItemsAction>;
19
+ }>, import("../actions/ui/slides").SetCurrentSlide | import("../actions/api/post-progression").ReceiveProgression | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/navigation").NavigateTo | import("../actions/ui/navigation").NavigateBack | import("../actions/ui/answers").EditBasicAction>;
21
20
  export default _default;
@@ -0,0 +1,4 @@
1
+ import { EditBasicAction } from '../../actions/ui/answers';
2
+ export declare type AnswerState = string[];
3
+ declare const reducer: (state: AnswerState | undefined, action: EditBasicAction) => AnswerState;
4
+ export default reducer;
@@ -1,10 +1,10 @@
1
- import { UPDATE_REVIEW_STATUS } from '../../actions/ui/review-status';
1
+ import { EDIT_BASIC } from '../../actions/ui/answers';
2
2
  var reducer = function (
3
3
  // eslint-disable-next-line default-param-last
4
4
  state, action) {
5
- if (state === void 0) { state = 'ongoing'; }
5
+ if (state === void 0) { state = []; }
6
6
  switch (action.type) {
7
- case UPDATE_REVIEW_STATUS: {
7
+ case EDIT_BASIC: {
8
8
  return action.payload;
9
9
  }
10
10
  default:
@@ -0,0 +1,4 @@
1
+ import { UISlidesAction } from '../../actions/ui/slides';
2
+ export declare type CurrentSlideRefState = string;
3
+ declare const reducer: (state: string | undefined, action: UISlidesAction) => CurrentSlideRefState;
4
+ export default reducer;
@@ -0,0 +1,14 @@
1
+ import { SET_CURRENT_SLIDE } from '../../actions/ui/slides';
2
+ var reducer = function (
3
+ // eslint-disable-next-line default-param-last
4
+ state, action) {
5
+ if (state === void 0) { state = ''; }
6
+ switch (action.type) {
7
+ case SET_CURRENT_SLIDE: {
8
+ return action.payload.id;
9
+ }
10
+ default:
11
+ return state;
12
+ }
13
+ };
14
+ export default reducer;
@@ -1,17 +1,14 @@
1
- import { FinishedSlidesState } from './finished-slides';
1
+ import { CurrentSlideRefState } from './current-slide-ref';
2
2
  import { NavigationState } from './navigation';
3
- import { ReviewStatusState } from './review-status';
4
- import { StepItemsState } from './step-items';
3
+ import { AnswerState } from './answers';
5
4
  export declare type UIState = {
5
+ currentSlideRef: CurrentSlideRefState;
6
6
  navigation: NavigationState;
7
- stepItems: StepItemsState;
8
- finishedSlides: FinishedSlidesState;
9
- reviewStatus: ReviewStatusState;
7
+ answers: AnswerState;
10
8
  };
11
9
  declare const _default: import("redux").Reducer<import("redux").CombinedState<{
12
- finishedSlides: FinishedSlidesState;
10
+ currentSlideRef: string;
13
11
  navigation: NavigationState;
14
- reviewStatus: ReviewStatusState;
15
- stepItems: StepItemsState;
16
- }>, import("../../actions/ui/finished-slides").UpdateFinishedSlides | import("../../actions/ui/navigation").NavigateTo | import("../../actions/ui/navigation").NavigateBack | import("../../actions/ui/review-status").UpdateReviewStatus | import("../../actions/ui/step-items").StepItemsAction>;
12
+ answers: AnswerState;
13
+ }>, import("../../actions/ui/slides").SetCurrentSlide | import("../../actions/ui/navigation").NavigateTo | import("../../actions/ui/navigation").NavigateBack | import("../../actions/ui/answers").EditBasicAction>;
17
14
  export default _default;
@@ -1,11 +1,9 @@
1
1
  import { combineReducers } from 'redux';
2
- import finishedSlides from './finished-slides';
2
+ import currentSlideRef from './current-slide-ref';
3
3
  import navigation from './navigation';
4
- import reviewStatus from './review-status';
5
- import stepItems from './step-items';
4
+ import answers from './answers';
6
5
  export default combineReducers({
7
- finishedSlides: finishedSlides,
6
+ currentSlideRef: currentSlideRef,
8
7
  navigation: navigation,
9
- reviewStatus: reviewStatus,
10
- stepItems: stepItems
8
+ answers: answers
11
9
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import test from 'ava';
2
+ import reducer from '../answers';
3
+ import { EDIT_BASIC } from '../../../actions/ui/answers';
4
+ test('should have inital value', function (t) {
5
+ var state = reducer(undefined, {});
6
+ t.deepEqual(state, []);
7
+ });
8
+ test('should set the value of EDIT_BASIC action', function (t) {
9
+ var state = reducer([], { type: EDIT_BASIC, payload: ['value'] });
10
+ t.deepEqual(state, ['value']);
11
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import test from 'ava';
2
+ import reducer from '../current-slide-ref';
3
+ import { SET_CURRENT_SLIDE } from '../../../actions/ui/slides';
4
+ import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
5
+ test('should have inital value', function (t) {
6
+ var state = reducer(undefined, {});
7
+ t.is(state, '');
8
+ });
9
+ test('should set the value of SET_CURRENT_SLIDE action', function (t) {
10
+ var state = reducer('', { type: SET_CURRENT_SLIDE, payload: freeTextSlide });
11
+ t.is(state, 'sli_VJYjJnJhg');
12
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import test from 'ava';
2
+ import reducer from '../navigation';
3
+ import { NAVIGATE_TO, NAVIGATE_BACK } from '../../../actions/ui/navigation';
4
+ test('should have inital value', function (t) {
5
+ var state = reducer(undefined, {});
6
+ t.deepEqual(state, []);
7
+ });
8
+ test('should set the value of NAVIGATE_TO and NAVIGATE_BACK action', function (t) {
9
+ var state = reducer([], { type: NAVIGATE_TO, payload: 'loader' });
10
+ t.deepEqual(state, ['loader']);
11
+ var updatedState = reducer(state, { type: NAVIGATE_TO, payload: 'skills' });
12
+ t.deepEqual(updatedState, ['loader', 'skills']);
13
+ var _updatedState = reducer(updatedState, { type: NAVIGATE_BACK });
14
+ t.deepEqual(_updatedState, ['loader']);
15
+ });
@@ -43,7 +43,7 @@ export var fetchSlide = function (slideRef, token) { return __awaiter(void 0, vo
43
43
  switch (_a.label) {
44
44
  case 0:
45
45
  host = decode(token).host;
46
- return [4 /*yield*/, crossFetch("".concat(host, "/api/v2/slide/").concat(slideRef), {
46
+ return [4 /*yield*/, crossFetch("".concat(host, "/api/v2/slide/").concat(slideRef, "/parentContentTitle"), {
47
47
  headers: { authorization: token }
48
48
  })];
49
49
  case 1:
@@ -1,8 +1,10 @@
1
1
  import { fetchSkills } from './fetch-skills';
2
2
  import { postProgression } from './post-progression';
3
3
  import { fetchSlide } from './fetch-slide';
4
+ import { postAnswer } from './post-answer';
4
5
  export var getServices = function () { return ({
5
6
  fetchSkills: fetchSkills,
6
7
  fetchSlide: fetchSlide,
7
- postProgression: postProgression
8
+ postProgression: postProgression,
9
+ postAnswer: postAnswer
8
10
  }); };
@@ -0,0 +1,2 @@
1
+ import { ProgressionFromAPI } from '../types/common';
2
+ export declare const postAnswer: (skillRef: string, token: string, progressionId: string, answer: string[]) => Promise<ProgressionFromAPI>;
@@ -0,0 +1,62 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import crossFetch from 'cross-fetch';
38
+ import decode from 'jwt-decode';
39
+ import { toJSON } from './tools/fetch-responses';
40
+ export var postAnswer = function (skillRef, token, progressionId, answer) { return __awaiter(void 0, void 0, void 0, function () {
41
+ var host, response;
42
+ return __generator(this, function (_a) {
43
+ switch (_a.label) {
44
+ case 0:
45
+ host = decode(token).host;
46
+ return [4 /*yield*/, crossFetch("".concat(host, "/api/v2/progressions/").concat(progressionId, "/answers"), {
47
+ method: 'post',
48
+ headers: { authorization: token },
49
+ body: JSON.stringify({
50
+ content: {
51
+ ref: skillRef,
52
+ type: 'slide'
53
+ },
54
+ answer: answer
55
+ })
56
+ })];
57
+ case 1:
58
+ response = _a.sent();
59
+ return [2 /*return*/, toJSON(response)];
60
+ }
61
+ });
62
+ }); };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import test from 'ava';
38
+ import nock from 'nock';
39
+ import { qcmDragSlide } from '../../views/slides/test/fixtures/qcm-drag';
40
+ import { fetchSlide } from '../fetch-slide';
41
+ test.before(function () {
42
+ nock('http://localhost:3000')
43
+ .get('/api/v2/slide/sli_123546/parentContentTitle')
44
+ .reply(200, qcmDragSlide);
45
+ });
46
+ test.after(function () {
47
+ nock.cleanAll();
48
+ });
49
+ test('should fetch a slide with the parentTitleContent info successfully', function (t) { return __awaiter(void 0, void 0, void 0, function () {
50
+ var token, slide;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0:
54
+ token = process.env.API_TEST_TOKEN || '';
55
+ return [4 /*yield*/, fetchSlide('sli_123546', token)];
56
+ case 1:
57
+ slide = _a.sent();
58
+ t.deepEqual(qcmDragSlide, slide);
59
+ return [2 /*return*/];
60
+ }
61
+ });
62
+ }); });
63
+ test('should reject if a bad token is passed', function (t) { return __awaiter(void 0, void 0, void 0, function () {
64
+ var badToken, error;
65
+ return __generator(this, function (_a) {
66
+ switch (_a.label) {
67
+ case 0:
68
+ badToken = 'token is not a jwt';
69
+ return [4 /*yield*/, t.throwsAsync(function () { return fetchSlide('sli_123546', badToken); })];
70
+ case 1:
71
+ error = _a.sent();
72
+ t.is(error === null || error === void 0 ? void 0 : error.message, "Invalid token specified: Cannot read properties of undefined (reading 'replace')");
73
+ return [2 /*return*/];
74
+ }
75
+ });
76
+ }); });
@@ -0,0 +1 @@
1
+ export {};