@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.
- 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 +2 -2
- 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,61 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { fetchSkills, SKILLS_FETCH_FAILURE, SKILLS_FETCH_REQUEST, SKILLS_FETCH_SUCCESS } from '../fetch-skills';
|
|
3
|
-
import { services as mockedServices } from '../../../test/util/services.mock';
|
|
4
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
5
|
-
const initialState = {
|
|
6
|
-
data: {
|
|
7
|
-
progression: null,
|
|
8
|
-
slides: {},
|
|
9
|
-
skills: [],
|
|
10
|
-
token: '1234',
|
|
11
|
-
corrections: {},
|
|
12
|
-
rank: {}
|
|
13
|
-
},
|
|
14
|
-
ui: {
|
|
15
|
-
currentSlideRef: '',
|
|
16
|
-
navigation: [],
|
|
17
|
-
answers: [],
|
|
18
|
-
slide: {
|
|
19
|
-
validateButton: false
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
test('should dispatch SKILLS_FETCH_SUCCESS actions when fetchSkills returns a list of skills', async (t) => {
|
|
24
|
-
t.plan(3);
|
|
25
|
-
const services = {
|
|
26
|
-
...mockedServices,
|
|
27
|
-
fetchSkills: token => {
|
|
28
|
-
t.is(token, '1234');
|
|
29
|
-
return Promise.resolve([]);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const expectedActions = [
|
|
33
|
-
{ type: SKILLS_FETCH_REQUEST },
|
|
34
|
-
{
|
|
35
|
-
type: SKILLS_FETCH_SUCCESS,
|
|
36
|
-
payload: []
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
40
|
-
await dispatch(fetchSkills);
|
|
41
|
-
});
|
|
42
|
-
test('should dispatch SKILLS_FETCH_FAILURE action when fetchSkills fails', async (t) => {
|
|
43
|
-
t.plan(3);
|
|
44
|
-
const services = {
|
|
45
|
-
...mockedServices,
|
|
46
|
-
fetchSkills: token => {
|
|
47
|
-
t.is(token, '1234');
|
|
48
|
-
return Promise.reject(new Error('unexpected'));
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const expectedActions = [
|
|
52
|
-
{ type: SKILLS_FETCH_REQUEST },
|
|
53
|
-
{
|
|
54
|
-
type: SKILLS_FETCH_FAILURE,
|
|
55
|
-
payload: new Error('unexpected'),
|
|
56
|
-
error: true
|
|
57
|
-
}
|
|
58
|
-
];
|
|
59
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
60
|
-
await dispatch(fetchSkills);
|
|
61
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { fetchSlide, SLIDE_FETCH_FAILURE, SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../fetch-slide';
|
|
3
|
-
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
4
|
-
import { services as mockedServices } from '../../../test/util/services.mock';
|
|
5
|
-
import { SET_CURRENT_SLIDE } from '../../ui/slides';
|
|
6
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
7
|
-
const initialState = {
|
|
8
|
-
data: {
|
|
9
|
-
progression: null,
|
|
10
|
-
slides: {},
|
|
11
|
-
skills: [],
|
|
12
|
-
token: '1234',
|
|
13
|
-
corrections: {},
|
|
14
|
-
rank: {}
|
|
15
|
-
},
|
|
16
|
-
ui: {
|
|
17
|
-
currentSlideRef: '',
|
|
18
|
-
navigation: [],
|
|
19
|
-
answers: [],
|
|
20
|
-
slide: {
|
|
21
|
-
validateButton: false
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
test('should dispatch FETCH_SUCCESS and SET_CURRENT_SLIDE actions when fetchSlide return a slide', async (t) => {
|
|
26
|
-
t.plan(5);
|
|
27
|
-
const services = {
|
|
28
|
-
...mockedServices,
|
|
29
|
-
fetchSlide: (slideRef, token) => {
|
|
30
|
-
t.is(token, '1234');
|
|
31
|
-
t.is(slideRef, 'sli_VJYjJnJhg');
|
|
32
|
-
return Promise.resolve(freeTextSlide);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const expectedActions = [
|
|
36
|
-
{ type: SLIDE_FETCH_REQUEST, meta: { slideRef: 'sli_VJYjJnJhg' } },
|
|
37
|
-
{
|
|
38
|
-
type: SLIDE_FETCH_SUCCESS,
|
|
39
|
-
meta: { slideRef: 'sli_VJYjJnJhg' },
|
|
40
|
-
payload: freeTextSlide
|
|
41
|
-
},
|
|
42
|
-
{ type: SET_CURRENT_SLIDE, payload: freeTextSlide }
|
|
43
|
-
];
|
|
44
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
45
|
-
await dispatch(fetchSlide('sli_VJYjJnJhg'));
|
|
46
|
-
});
|
|
47
|
-
test('should dispatch SLIDE_FETCH_FAILURE action when fetchSlide fails', async (t) => {
|
|
48
|
-
t.plan(4);
|
|
49
|
-
const services = {
|
|
50
|
-
...mockedServices,
|
|
51
|
-
fetchSlide: (slideRef, token) => {
|
|
52
|
-
t.is(token, '1234');
|
|
53
|
-
t.is(slideRef, 'slide_ref');
|
|
54
|
-
return Promise.reject(new Error('error'));
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const expectedActions = [
|
|
58
|
-
{ type: SLIDE_FETCH_REQUEST, meta: { slideRef: 'slide_ref' } },
|
|
59
|
-
{
|
|
60
|
-
type: SLIDE_FETCH_FAILURE,
|
|
61
|
-
meta: { slideRef: 'slide_ref' },
|
|
62
|
-
payload: new Error('error'),
|
|
63
|
-
error: true
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
67
|
-
await dispatch(fetchSlide('slide_ref'));
|
|
68
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
3
|
-
import { getChoicesCorrection, postAnswerResponses, services } from '../../../test/util/services.mock';
|
|
4
|
-
import { postAnswer, POST_ANSWER_FAILURE, POST_ANSWER_REQUEST, POST_ANSWER_SUCCESS } from '../post-answer';
|
|
5
|
-
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
6
|
-
import { CORRECTION_FETCH_REQUEST, CORRECTION_FETCH_SUCCESS } from '../fetch-correction';
|
|
7
|
-
import { SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../fetch-slide';
|
|
8
|
-
import { qcmSlide } from '../../../views/slides/test/fixtures/qcm';
|
|
9
|
-
import { qcmGraphicSlide } from '../../../views/slides/test/fixtures/qcm-graphic';
|
|
10
|
-
import { templateSlide } from '../../../views/slides/test/fixtures/template';
|
|
11
|
-
import { sliderSlide } from '../../../views/slides/test/fixtures/slider';
|
|
12
|
-
import { RANK_FETCH_START_REQUEST, RANK_FETCH_START_SUCCESS, RANK_FETCH_END_REQUEST, RANK_FETCH_END_SUCCESS } from '../fetch-rank';
|
|
13
|
-
const progressionId = '123456789123';
|
|
14
|
-
const skillRef = '_skill-ref';
|
|
15
|
-
const answer = ['Lister vos tâches pour vous libérer l’esprit', 'Vous isoler dans un lieu calme'];
|
|
16
|
-
const initialState = {
|
|
17
|
-
data: {
|
|
18
|
-
progression: {
|
|
19
|
-
_id: progressionId,
|
|
20
|
-
content: { type: 'skill', ref: skillRef },
|
|
21
|
-
engine: {
|
|
22
|
-
ref: 'review'
|
|
23
|
-
},
|
|
24
|
-
state: {
|
|
25
|
-
allAnswers: [],
|
|
26
|
-
isCorrect: true,
|
|
27
|
-
nextContent: {
|
|
28
|
-
ref: freeTextSlide._id,
|
|
29
|
-
type: 'slide'
|
|
30
|
-
},
|
|
31
|
-
pendingSlides: [],
|
|
32
|
-
slides: [],
|
|
33
|
-
step: {
|
|
34
|
-
current: 1
|
|
35
|
-
},
|
|
36
|
-
stars: 0
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
slides: {
|
|
40
|
-
[freeTextSlide._id]: freeTextSlide
|
|
41
|
-
},
|
|
42
|
-
skills: [{ skillRef, custom: false, name: skillRef, slidesToReview: 5 }],
|
|
43
|
-
token: '1234',
|
|
44
|
-
corrections: {},
|
|
45
|
-
rank: {}
|
|
46
|
-
},
|
|
47
|
-
ui: {
|
|
48
|
-
currentSlideRef: freeTextSlide._id,
|
|
49
|
-
navigation: ['skills', 'slides'],
|
|
50
|
-
answers: answer,
|
|
51
|
-
slide: {
|
|
52
|
-
validateButton: false
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
test('should dispatch post-answer, fetch-slide and fetch-correction and fetch-start-rank actions when the answer is submitted and when the slide ref is not "successExitNode"', async (t) => {
|
|
57
|
-
t.plan(10);
|
|
58
|
-
const expectedActions = [
|
|
59
|
-
{ type: POST_ANSWER_REQUEST },
|
|
60
|
-
{
|
|
61
|
-
type: POST_ANSWER_SUCCESS,
|
|
62
|
-
payload: postAnswerResponses[freeTextSlide._id]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: SLIDE_FETCH_REQUEST,
|
|
66
|
-
meta: {
|
|
67
|
-
slideRef: qcmGraphicSlide._id
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: SLIDE_FETCH_SUCCESS,
|
|
72
|
-
meta: {
|
|
73
|
-
slideRef: qcmGraphicSlide._id
|
|
74
|
-
},
|
|
75
|
-
payload: qcmGraphicSlide
|
|
76
|
-
},
|
|
77
|
-
{ type: CORRECTION_FETCH_REQUEST, meta: { slideRef: freeTextSlide._id } },
|
|
78
|
-
{
|
|
79
|
-
type: CORRECTION_FETCH_SUCCESS,
|
|
80
|
-
meta: { slideRef: freeTextSlide._id },
|
|
81
|
-
payload: getChoicesCorrection(freeTextSlide._id)
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
type: RANK_FETCH_START_REQUEST
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
type: RANK_FETCH_START_SUCCESS,
|
|
88
|
-
payload: { rank: 93 }
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
const { dispatch, getState } = createTestStore(t, initialState, services, expectedActions);
|
|
92
|
-
await dispatch(postAnswer);
|
|
93
|
-
const state = getState();
|
|
94
|
-
t.false(state.ui.slide.validateButton);
|
|
95
|
-
t.true(state.ui.slide.animateCorrectionPopin);
|
|
96
|
-
});
|
|
97
|
-
test('should dispatch post-answer, fetch-correction and fetch-end-rank actions when the answer is submitted and when the slide ref is "successExitNode"', async (t) => {
|
|
98
|
-
t.plan(8);
|
|
99
|
-
const stateBeforeExitNode = {
|
|
100
|
-
data: {
|
|
101
|
-
progression: postAnswerResponses[sliderSlide.universalRef],
|
|
102
|
-
slides: {
|
|
103
|
-
[freeTextSlide._id]: freeTextSlide,
|
|
104
|
-
[qcmGraphicSlide._id]: qcmGraphicSlide,
|
|
105
|
-
[qcmSlide._id]: qcmSlide,
|
|
106
|
-
[sliderSlide._id]: sliderSlide
|
|
107
|
-
},
|
|
108
|
-
skills: [{ skillRef, custom: false, name: skillRef, slidesToReview: 5 }],
|
|
109
|
-
token: '1234',
|
|
110
|
-
corrections: {},
|
|
111
|
-
rank: {}
|
|
112
|
-
},
|
|
113
|
-
ui: {
|
|
114
|
-
currentSlideRef: templateSlide._id,
|
|
115
|
-
navigation: ['skills', 'slides'],
|
|
116
|
-
answers: ['Leaderboard', 'utilisateurs', 'étoiles'],
|
|
117
|
-
slide: {
|
|
118
|
-
validateButton: false
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
const expectedActions = [
|
|
123
|
-
{ type: POST_ANSWER_REQUEST },
|
|
124
|
-
{
|
|
125
|
-
type: POST_ANSWER_SUCCESS,
|
|
126
|
-
payload: postAnswerResponses[templateSlide._id]
|
|
127
|
-
},
|
|
128
|
-
{ type: CORRECTION_FETCH_REQUEST, meta: { slideRef: templateSlide._id } },
|
|
129
|
-
{
|
|
130
|
-
type: CORRECTION_FETCH_SUCCESS,
|
|
131
|
-
meta: { slideRef: templateSlide._id },
|
|
132
|
-
payload: getChoicesCorrection(templateSlide._id)
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
type: RANK_FETCH_END_REQUEST
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
type: RANK_FETCH_END_SUCCESS,
|
|
139
|
-
payload: { rank: 93 }
|
|
140
|
-
}
|
|
141
|
-
];
|
|
142
|
-
const { dispatch, getState } = createTestStore(t, stateBeforeExitNode, services, expectedActions);
|
|
143
|
-
await dispatch(postAnswer);
|
|
144
|
-
const state = getState();
|
|
145
|
-
t.false(state.ui.slide.validateButton);
|
|
146
|
-
t.true(state.ui.slide.animateCorrectionPopin);
|
|
147
|
-
});
|
|
148
|
-
test('should dispatch POST_ANSWER_REQUEST, then POST_ANSWER_FAILURE on error', async (t) => {
|
|
149
|
-
t.plan(3);
|
|
150
|
-
const expectedActions = [
|
|
151
|
-
{ type: POST_ANSWER_REQUEST },
|
|
152
|
-
{
|
|
153
|
-
type: POST_ANSWER_FAILURE,
|
|
154
|
-
payload: new Error('unexpected'),
|
|
155
|
-
error: true
|
|
156
|
-
}
|
|
157
|
-
];
|
|
158
|
-
const { dispatch } = createTestStore(t, initialState, {
|
|
159
|
-
...services,
|
|
160
|
-
postAnswer: () => {
|
|
161
|
-
t.pass();
|
|
162
|
-
return Promise.reject(new Error('unexpected'));
|
|
163
|
-
}
|
|
164
|
-
}, expectedActions);
|
|
165
|
-
await dispatch(postAnswer);
|
|
166
|
-
});
|
|
167
|
-
test('should not dispatch any action && throw an error if progression does not exist', async (t) => {
|
|
168
|
-
t.plan(1);
|
|
169
|
-
const expectedActions = [];
|
|
170
|
-
const { dispatch } = createTestStore(t, { ...initialState, data: { ...initialState.data, progression: null } }, services, expectedActions);
|
|
171
|
-
await t.throwsAsync(() => dispatch(postAnswer), undefined, 'Cannot answer a question of an inexistent progression');
|
|
172
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { postProgression, POST_PROGRESSION_REQUEST, POST_PROGRESSION_SUCCESS, POST_PROGRESSION_FAILURE } from '../post-progression';
|
|
3
|
-
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
4
|
-
import { services as mockedServices } from '../../../test/util/services.mock';
|
|
5
|
-
import { SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../fetch-slide';
|
|
6
|
-
import { SET_CURRENT_SLIDE } from '../../ui/slides';
|
|
7
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
8
|
-
const initialState = {
|
|
9
|
-
data: {
|
|
10
|
-
progression: null,
|
|
11
|
-
slides: {},
|
|
12
|
-
skills: [],
|
|
13
|
-
token: '1234',
|
|
14
|
-
corrections: {},
|
|
15
|
-
rank: {}
|
|
16
|
-
},
|
|
17
|
-
ui: {
|
|
18
|
-
currentSlideRef: '',
|
|
19
|
-
navigation: [],
|
|
20
|
-
answers: [],
|
|
21
|
-
slide: {
|
|
22
|
-
validateButton: false
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
test('should dispatch POST_PROGRESSION_SUCCESS and SLIDE_FETCH_REQUEST actions when postProgression returns a progression', async (t) => {
|
|
27
|
-
t.plan(9);
|
|
28
|
-
const progression = {
|
|
29
|
-
_id: '62b1d1087aa12f00253f40ee',
|
|
30
|
-
content: {
|
|
31
|
-
ref: '_skill-ref',
|
|
32
|
-
type: 'skill'
|
|
33
|
-
},
|
|
34
|
-
engine: {
|
|
35
|
-
ref: 'review'
|
|
36
|
-
},
|
|
37
|
-
state: {
|
|
38
|
-
allAnswers: [],
|
|
39
|
-
isCorrect: true,
|
|
40
|
-
nextContent: {
|
|
41
|
-
ref: 'sli_VJYjJnJhg',
|
|
42
|
-
type: 'slide'
|
|
43
|
-
},
|
|
44
|
-
pendingSlides: [],
|
|
45
|
-
slides: [],
|
|
46
|
-
step: {
|
|
47
|
-
current: 1
|
|
48
|
-
},
|
|
49
|
-
stars: 0
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const services = {
|
|
53
|
-
...mockedServices,
|
|
54
|
-
postProgression: (skillRef, token) => {
|
|
55
|
-
t.is(token, '1234');
|
|
56
|
-
t.is(skillRef, 'skill_12345');
|
|
57
|
-
return Promise.resolve(progression);
|
|
58
|
-
},
|
|
59
|
-
fetchSlide: (slideRef, token) => {
|
|
60
|
-
t.is(token, '1234');
|
|
61
|
-
t.is(slideRef, 'sli_VJYjJnJhg');
|
|
62
|
-
return Promise.resolve(freeTextSlide);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const expectedActions = [
|
|
66
|
-
{ type: POST_PROGRESSION_REQUEST },
|
|
67
|
-
{
|
|
68
|
-
type: POST_PROGRESSION_SUCCESS,
|
|
69
|
-
payload: progression
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
type: SLIDE_FETCH_REQUEST,
|
|
73
|
-
meta: {
|
|
74
|
-
slideRef: 'sli_VJYjJnJhg'
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: SLIDE_FETCH_SUCCESS,
|
|
79
|
-
meta: {
|
|
80
|
-
slideRef: 'sli_VJYjJnJhg'
|
|
81
|
-
},
|
|
82
|
-
payload: freeTextSlide
|
|
83
|
-
},
|
|
84
|
-
{ type: SET_CURRENT_SLIDE, payload: freeTextSlide }
|
|
85
|
-
];
|
|
86
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
87
|
-
await dispatch(postProgression('skill_12345'));
|
|
88
|
-
});
|
|
89
|
-
test('should dispatch POST_PROGRESSION_FAILURE action when postProgression fails', async (t) => {
|
|
90
|
-
t.plan(4);
|
|
91
|
-
const services = {
|
|
92
|
-
...mockedServices,
|
|
93
|
-
postProgression: (skillRef, token) => {
|
|
94
|
-
t.is(token, '1234');
|
|
95
|
-
t.is(skillRef, 'skill_12345');
|
|
96
|
-
return Promise.reject(new Error('error'));
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const expectedActions = [
|
|
100
|
-
{ type: POST_PROGRESSION_REQUEST },
|
|
101
|
-
{
|
|
102
|
-
type: POST_PROGRESSION_FAILURE,
|
|
103
|
-
payload: new Error('error'),
|
|
104
|
-
error: true
|
|
105
|
-
}
|
|
106
|
-
];
|
|
107
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
108
|
-
await dispatch(postProgression('skill_12345'));
|
|
109
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
3
|
-
import { services } from '../../../test/util/services.mock';
|
|
4
|
-
import { storeToken, STORE_TOKEN } from '../token';
|
|
5
|
-
const initialState = {
|
|
6
|
-
data: {
|
|
7
|
-
progression: null,
|
|
8
|
-
slides: {},
|
|
9
|
-
skills: [],
|
|
10
|
-
token: '1234',
|
|
11
|
-
corrections: {},
|
|
12
|
-
rank: {}
|
|
13
|
-
},
|
|
14
|
-
ui: {
|
|
15
|
-
currentSlideRef: '',
|
|
16
|
-
navigation: [],
|
|
17
|
-
answers: [],
|
|
18
|
-
slide: {
|
|
19
|
-
validateButton: false
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
test('should dispatch STORE_TOKEN action when storeToken is called', async (t) => {
|
|
24
|
-
const expectedActions = [{ type: STORE_TOKEN, payload: 'JWT.token' }];
|
|
25
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
26
|
-
await dispatch(storeToken('JWT.token'));
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import pipe from 'lodash/fp/pipe';
|
|
3
|
-
import set from 'lodash/fp/set';
|
|
4
|
-
import omit from 'lodash/fp/omit';
|
|
5
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
6
|
-
import { services } from '../../../test/util/services.mock';
|
|
7
|
-
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
8
|
-
import { qcmDragSlide } from '../../../views/slides/test/fixtures/qcm-drag';
|
|
9
|
-
import { qcmSlide } from '../../../views/slides/test/fixtures/qcm';
|
|
10
|
-
import { qcmGraphicSlide } from '../../../views/slides/test/fixtures/qcm-graphic';
|
|
11
|
-
import { sliderSlide } from '../../../views/slides/test/fixtures/slider';
|
|
12
|
-
import { templateSlide } from '../../../views/slides/test/fixtures/template';
|
|
13
|
-
import { editAnswer, ANSWER_EDIT } from '../answers';
|
|
14
|
-
const initialState = {
|
|
15
|
-
data: {
|
|
16
|
-
progression: {
|
|
17
|
-
_id: '62b1d1087aa12f00253f40ee',
|
|
18
|
-
content: {
|
|
19
|
-
ref: '_skill-ref',
|
|
20
|
-
type: 'skill'
|
|
21
|
-
},
|
|
22
|
-
engine: {
|
|
23
|
-
ref: 'review'
|
|
24
|
-
},
|
|
25
|
-
state: {
|
|
26
|
-
allAnswers: [],
|
|
27
|
-
isCorrect: true,
|
|
28
|
-
nextContent: {
|
|
29
|
-
ref: '',
|
|
30
|
-
type: 'slide'
|
|
31
|
-
},
|
|
32
|
-
pendingSlides: [],
|
|
33
|
-
slides: [],
|
|
34
|
-
step: {
|
|
35
|
-
current: 1
|
|
36
|
-
},
|
|
37
|
-
stars: 0
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
slides: {},
|
|
41
|
-
skills: [],
|
|
42
|
-
token: '1234',
|
|
43
|
-
corrections: {},
|
|
44
|
-
rank: {}
|
|
45
|
-
},
|
|
46
|
-
ui: {
|
|
47
|
-
currentSlideRef: '',
|
|
48
|
-
navigation: [],
|
|
49
|
-
answers: [],
|
|
50
|
-
slide: {
|
|
51
|
-
validateButton: false
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const buildInitialState = (state, question) => {
|
|
56
|
-
return pipe(set(['data', 'progression', 'state', 'nextContent', 'ref'], question._id), set(['data', 'slides', question._id], question), set(['ui', 'currentSlideRef'], question._id))(state);
|
|
57
|
-
};
|
|
58
|
-
test('editAnswer should throw an Error if the slide is not found', async (t) => {
|
|
59
|
-
const state = buildInitialState(initialState, freeTextSlide);
|
|
60
|
-
const expectedActions = [{ type: undefined, payload: [] }];
|
|
61
|
-
const { dispatch } = createTestStore(t, omit(['data', 'slides'], state), services, expectedActions);
|
|
62
|
-
await t.throws(() => dispatch(editAnswer(['Some kind of answer'])), undefined, 'No slide was found or questionType was not found');
|
|
63
|
-
});
|
|
64
|
-
test('editAnswer should throw an Error for unsupported questions', async (t) => {
|
|
65
|
-
const state = buildInitialState(initialState, {
|
|
66
|
-
...freeTextSlide,
|
|
67
|
-
question: { ...freeTextSlide.question, type: 'unsupportedType' }
|
|
68
|
-
});
|
|
69
|
-
const { dispatch } = createTestStore(t, state, services, []);
|
|
70
|
-
await t.throws(() => dispatch(editAnswer(['Some kind of answer'])), undefined, 'Question type unsupportedType is not supported');
|
|
71
|
-
});
|
|
72
|
-
test('should dispatch EDIT_BASIC action when editAnswer is called', async (t) => {
|
|
73
|
-
const state = buildInitialState(initialState, freeTextSlide);
|
|
74
|
-
const expectedActions = [{ type: ANSWER_EDIT.basic, payload: ['My Answer'] }];
|
|
75
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
76
|
-
await dispatch(editAnswer(['My Answer']));
|
|
77
|
-
});
|
|
78
|
-
test('should dispatch EDIT_QCM action when editAnswer is called', async (t) => {
|
|
79
|
-
let state = buildInitialState(initialState, qcmSlide);
|
|
80
|
-
state = set(['ui', 'answers'], ['My First Answer', 'My Second Answer'], state);
|
|
81
|
-
const expectedActions = [{ type: ANSWER_EDIT.qcm, payload: ['My First Answer'] }];
|
|
82
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
83
|
-
await dispatch(editAnswer(['My Second Answer']));
|
|
84
|
-
});
|
|
85
|
-
test('should dispatch EDIT_QCM_GRAPHIC action when editAnswer is called', async (t) => {
|
|
86
|
-
let state = buildInitialState(initialState, qcmGraphicSlide);
|
|
87
|
-
state = set(['ui', 'answers'], ['My First Answer', 'My Second Answer', 'My Third Answer'], state);
|
|
88
|
-
const expectedActions = [
|
|
89
|
-
{ type: ANSWER_EDIT.qcmGraphic, payload: ['My First Answer', 'My Third Answer'] }
|
|
90
|
-
];
|
|
91
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
92
|
-
await dispatch(editAnswer(['My Second Answer']));
|
|
93
|
-
});
|
|
94
|
-
test('should dispatch EDIT_QCM_DRAG action when editAnswer is called', async (t) => {
|
|
95
|
-
let state = buildInitialState(initialState, qcmDragSlide);
|
|
96
|
-
state = set(['ui', 'answers'], ['My First Answer', 'My Second Answer'], state);
|
|
97
|
-
const expectedActions = [
|
|
98
|
-
{ type: ANSWER_EDIT.qcmDrag, payload: ['My First Answer', 'My Second Answer', 'My Third Answer'] }
|
|
99
|
-
];
|
|
100
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
101
|
-
await dispatch(editAnswer(['My Third Answer']));
|
|
102
|
-
});
|
|
103
|
-
test('should dispatch EDIT_SLIDER action when editAnswer is called', async (t) => {
|
|
104
|
-
const state = buildInitialState(initialState, sliderSlide);
|
|
105
|
-
const expectedActions = [{ type: ANSWER_EDIT.slider, payload: ['5'] }];
|
|
106
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
107
|
-
await dispatch(editAnswer(['5']));
|
|
108
|
-
});
|
|
109
|
-
test('should dispatch EDIT_TEMPLATE action when editAnswer is called', async (t) => {
|
|
110
|
-
let state = buildInitialState(initialState, templateSlide);
|
|
111
|
-
state = set(['ui', 'answers'], ['Catalogue', '', 'étoiles'], state);
|
|
112
|
-
const expectedActions = [
|
|
113
|
-
{ type: ANSWER_EDIT.template, payload: ['Catalogue', 'My Answer', 'étoiles'] }
|
|
114
|
-
];
|
|
115
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
116
|
-
await dispatch(editAnswer(['Catalogue', 'My Answer', 'étoiles']));
|
|
117
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import pipe from 'lodash/fp/pipe';
|
|
3
|
-
import set from 'lodash/fp/set';
|
|
4
|
-
import { nextSlide, NEXT_SLIDE } from '../next-slide';
|
|
5
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
6
|
-
import { getChoicesCorrection, postAnswerResponses, services } from '../../../test/util/services.mock';
|
|
7
|
-
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
8
|
-
import { qcmGraphicSlide } from '../../../views/slides/test/fixtures/qcm-graphic';
|
|
9
|
-
const progression = postAnswerResponses[freeTextSlide.universalRef];
|
|
10
|
-
const skillRef = '_skill-ref';
|
|
11
|
-
const answer = ['Vous isoler dans un lieu calme'];
|
|
12
|
-
const state = {
|
|
13
|
-
data: {
|
|
14
|
-
progression,
|
|
15
|
-
slides: {
|
|
16
|
-
[freeTextSlide.universalRef]: freeTextSlide,
|
|
17
|
-
[qcmGraphicSlide.universalRef]: qcmGraphicSlide
|
|
18
|
-
},
|
|
19
|
-
skills: [{ skillRef, custom: false, name: skillRef, slidesToReview: 5 }],
|
|
20
|
-
token: '1234',
|
|
21
|
-
corrections: { [freeTextSlide.universalRef]: getChoicesCorrection(freeTextSlide.universalRef) },
|
|
22
|
-
rank: { start: 93 }
|
|
23
|
-
},
|
|
24
|
-
ui: {
|
|
25
|
-
currentSlideRef: freeTextSlide._id,
|
|
26
|
-
navigation: ['loader', 'slides'],
|
|
27
|
-
answers: answer,
|
|
28
|
-
slide: {
|
|
29
|
-
validateButton: false,
|
|
30
|
-
animateCorrectionPopin: true,
|
|
31
|
-
showCorrectionPopin: true
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
test('should dispatch NEXT_SLIDE action when nextSlide is called and the progression state is correct', t => {
|
|
36
|
-
const expectedActions = [
|
|
37
|
-
{
|
|
38
|
-
type: NEXT_SLIDE,
|
|
39
|
-
payload: {
|
|
40
|
-
currentSlideRef: freeTextSlide.universalRef,
|
|
41
|
-
nextSlideRef: qcmGraphicSlide.universalRef,
|
|
42
|
-
animationType: 'unstack'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
];
|
|
46
|
-
const { dispatch } = createTestStore(t, state, services, expectedActions);
|
|
47
|
-
dispatch(nextSlide);
|
|
48
|
-
});
|
|
49
|
-
test('should dispatch NEXT_SLIDE action when nextSlide is called and the progression state is not correct', t => {
|
|
50
|
-
const stateWithWrongAnswer = pipe(set(['data', 'progression', 'state', 'isCorrect'], false), set(['data', 'progression', 'state', 'allAnswers', 0, 'isCorrect'], false))(state);
|
|
51
|
-
const expectedActions = [
|
|
52
|
-
{
|
|
53
|
-
type: NEXT_SLIDE,
|
|
54
|
-
payload: {
|
|
55
|
-
currentSlideRef: freeTextSlide.universalRef,
|
|
56
|
-
nextSlideRef: qcmGraphicSlide.universalRef,
|
|
57
|
-
animationType: 'restack'
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
];
|
|
61
|
-
const { dispatch } = createTestStore(t, stateWithWrongAnswer, services, expectedActions);
|
|
62
|
-
dispatch(nextSlide);
|
|
63
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { createTestStore } from '../../test/create-test-store';
|
|
3
|
-
import { services } from '../../../test/util/services.mock';
|
|
4
|
-
import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
|
|
5
|
-
import { setCurrentSlide, SET_CURRENT_SLIDE } from '../slides';
|
|
6
|
-
const initialState = {
|
|
7
|
-
data: {
|
|
8
|
-
progression: null,
|
|
9
|
-
slides: {},
|
|
10
|
-
skills: [],
|
|
11
|
-
token: '1234',
|
|
12
|
-
corrections: {},
|
|
13
|
-
rank: {}
|
|
14
|
-
},
|
|
15
|
-
ui: {
|
|
16
|
-
currentSlideRef: '',
|
|
17
|
-
navigation: [],
|
|
18
|
-
answers: [],
|
|
19
|
-
slide: {
|
|
20
|
-
validateButton: false
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
test('should dispatch SET_CURRENT_SLIDE action when setCurrentSlide is called', async (t) => {
|
|
25
|
-
const expectedActions = [{ type: SET_CURRENT_SLIDE, payload: freeTextSlide }];
|
|
26
|
-
const { dispatch } = createTestStore(t, initialState, services, expectedActions);
|
|
27
|
-
await dispatch(setCurrentSlide(freeTextSlide));
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|