@coorpacademy/app-review 0.2.12 → 0.3.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/actions/api/fetch-correction.js +1 -1
- package/es/actions/api/post-answer.d.ts +6 -0
- package/es/actions/api/post-answer.js +3 -1
- package/es/actions/ui/answers.d.ts +3 -0
- package/es/actions/ui/answers.js +3 -1
- package/es/reducers/index.d.ts +1 -1
- package/es/reducers/ui/answers.d.ts +4 -2
- package/es/reducers/ui/answers.js +6 -3
- package/es/reducers/ui/index.d.ts +4 -4
- package/es/reducers/ui/slide.d.ts +6 -4
- package/es/reducers/ui/slide.js +12 -4
- package/es/views/slides/index.js +4 -4
- package/lib/actions/api/fetch-correction.js +1 -1
- package/lib/actions/api/post-answer.d.ts +6 -0
- package/lib/actions/api/post-answer.js +4 -2
- package/lib/actions/ui/answers.d.ts +3 -0
- package/lib/actions/ui/answers.js +3 -1
- package/lib/reducers/index.d.ts +1 -1
- package/lib/reducers/ui/answers.d.ts +4 -2
- package/lib/reducers/ui/answers.js +6 -3
- package/lib/reducers/ui/index.d.ts +4 -4
- package/lib/reducers/ui/slide.d.ts +6 -4
- package/lib/reducers/ui/slide.js +12 -4
- package/lib/views/slides/index.js +4 -4
- package/package.json +4 -4
- package/src/actions/api/fetch-correction.ts +1 -1
- package/src/actions/api/post-answer.ts +5 -1
- package/src/actions/api/test/fetch-correction.test.ts +6 -2
- package/src/actions/api/test/fetch-rank.test.ts +2 -4
- package/src/actions/api/test/fetch-skills.test.ts +2 -4
- package/src/actions/api/test/fetch-slide.test.ts +2 -4
- package/src/actions/api/test/post-answer.test.ts +52 -13
- package/src/actions/api/test/post-progression.test.ts +2 -4
- package/src/actions/data/test/token.test.ts +2 -4
- package/src/actions/ui/answers.ts +4 -1
- package/src/actions/ui/test/answers.test.ts +38 -14
- package/src/actions/ui/test/next-slide.test.ts +8 -4
- package/src/actions/ui/test/slides.test.ts +2 -4
- package/src/reducers/data/test/progression.test.ts +1 -0
- package/src/reducers/ui/answers.ts +11 -5
- package/src/reducers/ui/index.ts +2 -2
- package/src/reducers/ui/slide.ts +30 -9
- package/src/reducers/ui/test/answers.test.ts +61 -13
- package/src/reducers/ui/test/slide.test.ts +36 -7
- package/src/views/skills/test/skills.test.ts +4 -8
- package/src/views/slides/index.ts +4 -4
- package/src/views/slides/test/index.test.ts +173 -28
- package/src/views/slides/test/slide.free-text.on-change.test.ts +7 -2
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +7 -2
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +7 -2
- package/src/views/slides/test/slide.qcm.on-click.test.ts +7 -2
- package/src/views/slides/test/slide.slider.on-change.test.ts +7 -2
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +7 -2
- package/src/views/slides/test/slide.template.on-change.test.ts +12 -4
- package/es/actions/api/test/fetch-correction.test.d.ts +0 -1
- package/es/actions/api/test/fetch-correction.test.js +0 -91
- package/es/actions/api/test/fetch-rank.test.d.ts +0 -1
- package/es/actions/api/test/fetch-rank.test.js +0 -100
- package/es/actions/api/test/fetch-skills.test.d.ts +0 -1
- package/es/actions/api/test/fetch-skills.test.js +0 -61
- package/es/actions/api/test/fetch-slide.test.d.ts +0 -1
- package/es/actions/api/test/fetch-slide.test.js +0 -68
- package/es/actions/api/test/post-answer.test.d.ts +0 -1
- package/es/actions/api/test/post-answer.test.js +0 -172
- package/es/actions/api/test/post-progression.test.d.ts +0 -1
- package/es/actions/api/test/post-progression.test.js +0 -109
- package/es/actions/data/test/token.test.d.ts +0 -1
- package/es/actions/data/test/token.test.js +0 -27
- package/es/actions/ui/test/answers.test.d.ts +0 -1
- package/es/actions/ui/test/answers.test.js +0 -117
- package/es/actions/ui/test/next-slide.test.d.ts +0 -1
- package/es/actions/ui/test/next-slide.test.js +0 -63
- package/es/actions/ui/test/slides.test.d.ts +0 -1
- package/es/actions/ui/test/slides.test.js +0 -28
- package/es/reducers/data/test/corrections.test.d.ts +0 -1
- package/es/reducers/data/test/corrections.test.js +0 -27
- package/es/reducers/data/test/progression.test.d.ts +0 -1
- package/es/reducers/data/test/progression.test.js +0 -24
- package/es/reducers/data/test/rank.test.d.ts +0 -1
- package/es/reducers/data/test/rank.test.js +0 -59
- package/es/reducers/data/test/skills.test.d.ts +0 -1
- package/es/reducers/data/test/skills.test.js +0 -12
- package/es/reducers/data/test/slides.test.d.ts +0 -1
- package/es/reducers/data/test/slides.test.js +0 -21
- package/es/reducers/data/test/token.test.d.ts +0 -1
- package/es/reducers/data/test/token.test.js +0 -11
- package/es/reducers/ui/test/answers.test.d.ts +0 -1
- package/es/reducers/ui/test/answers.test.js +0 -31
- package/es/reducers/ui/test/current-slide-ref.test.d.ts +0 -1
- package/es/reducers/ui/test/current-slide-ref.test.js +0 -12
- package/es/reducers/ui/test/navigation.test.d.ts +0 -1
- package/es/reducers/ui/test/navigation.test.js +0 -15
- package/es/reducers/ui/test/slide.test.d.ts +0 -1
- package/es/reducers/ui/test/slide.test.js +0 -24
- package/es/services/test/fetch-correction.test.d.ts +0 -1
- package/es/services/test/fetch-correction.test.js +0 -39
- package/es/services/test/fetch-rank.test.d.ts +0 -1
- package/es/services/test/fetch-rank.test.js +0 -24
- package/es/services/test/fetch-skills.test.d.ts +0 -1
- package/es/services/test/fetch-skills.test.js +0 -29
- package/es/services/test/fetch-slide.test.d.ts +0 -1
- package/es/services/test/fetch-slide.test.js +0 -22
- package/es/services/test/post-answer.test.d.ts +0 -1
- package/es/services/test/post-answer.test.js +0 -88
- package/es/services/test/post-progression.test.d.ts +0 -1
- package/es/services/test/post-progression.test.js +0 -56
- package/es/views/skills/test/skills.test.d.ts +0 -1
- package/es/views/skills/test/skills.test.js +0 -98
- package/es/views/slides/test/index.test.d.ts +0 -1
- package/es/views/slides/test/index.test.js +0 -979
- package/es/views/slides/test/map-api-slide-to-ui.test.d.ts +0 -1
- package/es/views/slides/test/map-api-slide-to-ui.test.js +0 -36
- package/es/views/slides/test/slide.free-text.on-change.test.d.ts +0 -1
- package/es/views/slides/test/slide.free-text.on-change.test.js +0 -72
- package/es/views/slides/test/slide.qcm-drag.on-click.test.d.ts +0 -1
- package/es/views/slides/test/slide.qcm-drag.on-click.test.js +0 -72
- package/es/views/slides/test/slide.qcm-graphic.on-click.test.d.ts +0 -1
- package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +0 -72
- package/es/views/slides/test/slide.qcm.on-click.test.d.ts +0 -1
- package/es/views/slides/test/slide.qcm.on-click.test.js +0 -74
- package/es/views/slides/test/slide.slider.on-change.test.d.ts +0 -1
- package/es/views/slides/test/slide.slider.on-change.test.js +0 -73
- package/es/views/slides/test/slide.slider.on-slider-change.test.d.ts +0 -1
- package/es/views/slides/test/slide.slider.on-slider-change.test.js +0 -63
- package/es/views/slides/test/slide.template.on-change.test.d.ts +0 -1
- package/es/views/slides/test/slide.template.on-change.test.js +0 -85
- package/lib/actions/api/test/fetch-correction.test.d.ts +0 -1
- package/lib/actions/api/test/fetch-correction.test.js +0 -151
- package/lib/actions/api/test/fetch-rank.test.d.ts +0 -1
- package/lib/actions/api/test/fetch-rank.test.js +0 -171
- package/lib/actions/api/test/fetch-skills.test.d.ts +0 -1
- package/lib/actions/api/test/fetch-skills.test.js +0 -120
- package/lib/actions/api/test/fetch-slide.test.d.ts +0 -1
- package/lib/actions/api/test/fetch-slide.test.js +0 -127
- package/lib/actions/api/test/post-answer.test.d.ts +0 -1
- package/lib/actions/api/test/post-answer.test.js +0 -254
- package/lib/actions/api/test/post-progression.test.d.ts +0 -1
- package/lib/actions/api/test/post-progression.test.js +0 -167
- package/lib/actions/data/test/token.test.d.ts +0 -1
- package/lib/actions/data/test/token.test.js +0 -72
- package/lib/actions/ui/test/answers.test.d.ts +0 -1
- package/lib/actions/ui/test/answers.test.js +0 -233
- package/lib/actions/ui/test/next-slide.test.d.ts +0 -1
- package/lib/actions/ui/test/next-slide.test.js +0 -64
- package/lib/actions/ui/test/slides.test.d.ts +0 -1
- package/lib/actions/ui/test/slides.test.js +0 -73
- package/lib/reducers/data/test/corrections.test.d.ts +0 -1
- package/lib/reducers/data/test/corrections.test.js +0 -28
- package/lib/reducers/data/test/progression.test.d.ts +0 -1
- package/lib/reducers/data/test/progression.test.js +0 -24
- package/lib/reducers/data/test/rank.test.d.ts +0 -1
- package/lib/reducers/data/test/rank.test.js +0 -59
- package/lib/reducers/data/test/skills.test.d.ts +0 -1
- package/lib/reducers/data/test/skills.test.js +0 -12
- package/lib/reducers/data/test/slides.test.d.ts +0 -1
- package/lib/reducers/data/test/slides.test.js +0 -22
- package/lib/reducers/data/test/token.test.d.ts +0 -1
- package/lib/reducers/data/test/token.test.js +0 -11
- package/lib/reducers/ui/test/answers.test.d.ts +0 -1
- package/lib/reducers/ui/test/answers.test.js +0 -31
- package/lib/reducers/ui/test/current-slide-ref.test.d.ts +0 -1
- package/lib/reducers/ui/test/current-slide-ref.test.js +0 -12
- package/lib/reducers/ui/test/navigation.test.d.ts +0 -1
- package/lib/reducers/ui/test/navigation.test.js +0 -15
- package/lib/reducers/ui/test/slide.test.d.ts +0 -1
- package/lib/reducers/ui/test/slide.test.js +0 -24
- package/lib/services/test/fetch-correction.test.d.ts +0 -1
- package/lib/services/test/fetch-correction.test.js +0 -95
- package/lib/services/test/fetch-rank.test.d.ts +0 -1
- package/lib/services/test/fetch-rank.test.js +0 -78
- package/lib/services/test/fetch-skills.test.d.ts +0 -1
- package/lib/services/test/fetch-skills.test.js +0 -83
- package/lib/services/test/fetch-slide.test.d.ts +0 -1
- package/lib/services/test/fetch-slide.test.js +0 -76
- package/lib/services/test/post-answer.test.d.ts +0 -1
- package/lib/services/test/post-answer.test.js +0 -142
- package/lib/services/test/post-progression.test.d.ts +0 -1
- package/lib/services/test/post-progression.test.js +0 -110
- package/lib/views/skills/test/skills.test.d.ts +0 -1
- package/lib/views/skills/test/skills.test.js +0 -98
- package/lib/views/slides/test/index.test.d.ts +0 -1
- package/lib/views/slides/test/index.test.js +0 -990
- package/lib/views/slides/test/map-api-slide-to-ui.test.d.ts +0 -1
- package/lib/views/slides/test/map-api-slide-to-ui.test.js +0 -47
- package/lib/views/slides/test/slide.free-text.on-change.test.d.ts +0 -1
- package/lib/views/slides/test/slide.free-text.on-change.test.js +0 -74
- package/lib/views/slides/test/slide.qcm-drag.on-click.test.d.ts +0 -1
- package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +0 -74
- package/lib/views/slides/test/slide.qcm-graphic.on-click.test.d.ts +0 -1
- package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +0 -74
- package/lib/views/slides/test/slide.qcm.on-click.test.d.ts +0 -1
- package/lib/views/slides/test/slide.qcm.on-click.test.js +0 -76
- package/lib/views/slides/test/slide.slider.on-change.test.d.ts +0 -1
- package/lib/views/slides/test/slide.slider.on-change.test.js +0 -75
- package/lib/views/slides/test/slide.slider.on-slider-change.test.d.ts +0 -1
- package/lib/views/slides/test/slide.slider.on-slider-change.test.js +0 -65
- package/lib/views/slides/test/slide.template.on-change.test.d.ts +0 -1
- 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 {};
|