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