@coorpacademy/app-review 0.1.16 → 0.1.18
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-skills.d.ts +3 -3
- package/es/actions/api/fetch-skills.js +7 -2
- package/es/actions/api/fetch-slide.d.ts +1 -1
- package/es/actions/api/fetch-slide.js +3 -1
- package/es/actions/api/post-answer.d.ts +14 -0
- package/es/actions/api/post-answer.js +25 -0
- package/es/actions/api/post-progression.d.ts +3 -3
- package/es/actions/api/post-progression.js +5 -2
- package/es/actions/api/test/fetch-skills.test.js +7 -4
- package/es/actions/api/test/fetch-slide.test.js +7 -4
- package/es/actions/api/test/post-answer.test.d.ts +1 -0
- package/es/actions/api/test/post-answer.test.js +82 -0
- package/es/actions/api/test/post-progression.test.js +7 -4
- package/es/actions/data/test/token.test.d.ts +1 -0
- package/es/actions/data/test/token.test.js +25 -0
- package/es/actions/index.d.ts +1 -8
- package/es/actions/{api/test → test}/create-test-store.d.ts +2 -2
- package/es/actions/{api/test → test}/create-test-store.js +1 -1
- package/es/actions/ui/answers.d.ts +17 -3
- package/es/actions/ui/answers.js +41 -3
- package/es/actions/ui/slides.d.ts +0 -5
- package/es/actions/ui/slides.js +0 -4
- package/es/actions/ui/test/answers.test.d.ts +1 -0
- package/es/actions/ui/test/answers.test.js +100 -0
- package/es/actions/ui/test/slides.test.d.ts +1 -0
- package/es/actions/ui/test/slides.test.js +26 -0
- package/es/common/index.d.ts +0 -3
- package/es/common/index.js +0 -4
- package/es/index.js +1 -3
- package/es/reducers/data/index.d.ts +1 -1
- package/es/reducers/data/progression.d.ts +3 -3
- package/es/reducers/data/progression.js +2 -5
- package/es/reducers/data/slides.d.ts +2 -3
- package/es/reducers/data/test/progression.test.js +12 -27
- package/es/reducers/index.d.ts +2 -1
- package/es/reducers/ui/answers.d.ts +2 -2
- package/es/reducers/ui/answers.js +4 -8
- package/es/reducers/ui/index.d.ts +4 -1
- package/es/reducers/ui/index.js +3 -1
- package/es/reducers/ui/slide.d.ts +8 -0
- package/es/reducers/ui/slide.js +26 -0
- package/es/reducers/ui/test/answers.test.js +23 -3
- package/es/reducers/ui/test/current-slide-ref.test.js +1 -1
- package/es/reducers/ui/test/navigation.test.js +5 -5
- package/es/reducers/ui/test/slide.test.d.ts +1 -0
- package/es/reducers/ui/test/slide.test.js +12 -0
- package/es/test/util/services.mock.d.ts +3 -1
- package/es/test/util/services.mock.js +89 -72
- package/es/types/common.d.ts +0 -25
- package/es/views/skills/index.d.ts +1 -1
- package/es/views/skills/index.js +0 -3
- package/es/views/skills/test/skills.test.d.ts +1 -0
- package/es/views/skills/test/skills.test.js +94 -0
- package/es/views/slides/index.d.ts +13 -2
- package/es/views/slides/index.js +19 -15
- package/es/views/slides/map-api-slide-to-ui.js +65 -68
- package/es/views/slides/test/fixtures/free-text.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm-drag.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm-graphic.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm.d.ts +2 -1
- package/es/views/slides/test/fixtures/slider.d.ts +2 -1
- package/es/views/slides/test/fixtures/template.d.ts +4 -0
- package/{lib/views/slides/test/fixtures/select-template.js → es/views/slides/test/fixtures/template.js} +82 -4
- package/es/views/slides/test/index.test.d.ts +1 -0
- package/es/views/slides/test/index.test.js +473 -0
- package/es/views/slides/test/map-api-slide-to-ui.test.js +4 -10
- package/es/views/slides/test/slide.template.on-change.test.d.ts +1 -0
- package/es/views/slides/test/slide.template.on-change.test.js +79 -0
- package/lib/actions/api/fetch-skills.d.ts +3 -3
- package/lib/actions/api/fetch-skills.js +22 -19
- package/lib/actions/api/fetch-slide.d.ts +1 -1
- package/lib/actions/api/fetch-slide.js +3 -1
- package/lib/actions/api/post-answer.d.ts +14 -0
- package/lib/actions/api/post-answer.js +75 -0
- package/lib/actions/api/post-progression.d.ts +3 -3
- package/lib/actions/api/post-progression.js +6 -3
- package/lib/actions/api/test/fetch-skills.test.js +7 -4
- package/lib/actions/api/test/fetch-slide.test.js +7 -4
- package/lib/actions/api/test/post-answer.test.d.ts +1 -0
- package/lib/actions/api/test/post-answer.test.js +145 -0
- package/lib/actions/api/test/post-progression.test.js +7 -4
- package/lib/actions/data/test/token.test.d.ts +1 -0
- package/lib/actions/data/test/token.test.js +70 -0
- package/lib/actions/index.d.ts +1 -8
- package/lib/actions/{api/test → test}/create-test-store.d.ts +2 -2
- package/lib/actions/{api/test → test}/create-test-store.js +1 -1
- package/lib/actions/ui/answers.d.ts +17 -3
- package/lib/actions/ui/answers.js +50 -3
- package/lib/actions/ui/slides.d.ts +0 -5
- package/lib/actions/ui/slides.js +0 -4
- package/lib/actions/ui/test/answers.test.d.ts +1 -0
- package/lib/actions/ui/test/answers.test.js +190 -0
- package/lib/actions/ui/test/slides.test.d.ts +1 -0
- package/lib/actions/ui/test/slides.test.js +71 -0
- package/lib/common/index.d.ts +0 -3
- package/lib/common/index.js +0 -4
- package/lib/index.js +1 -3
- package/lib/reducers/data/index.d.ts +1 -1
- package/lib/reducers/data/progression.d.ts +3 -3
- package/lib/reducers/data/progression.js +2 -5
- package/lib/reducers/data/slides.d.ts +2 -3
- package/lib/reducers/data/test/progression.test.js +12 -27
- package/lib/reducers/index.d.ts +2 -1
- package/lib/reducers/ui/answers.d.ts +2 -2
- package/lib/reducers/ui/answers.js +4 -8
- package/lib/reducers/ui/index.d.ts +4 -1
- package/lib/reducers/ui/index.js +3 -1
- package/lib/reducers/ui/slide.d.ts +8 -0
- package/lib/reducers/ui/slide.js +27 -0
- package/lib/reducers/ui/test/answers.test.js +23 -3
- package/lib/reducers/ui/test/current-slide-ref.test.js +1 -1
- package/lib/reducers/ui/test/navigation.test.js +5 -5
- package/lib/reducers/ui/test/slide.test.d.ts +1 -0
- package/lib/reducers/ui/test/slide.test.js +12 -0
- package/lib/test/util/services.mock.d.ts +3 -1
- package/lib/test/util/services.mock.js +89 -72
- package/lib/types/common.d.ts +0 -25
- package/lib/views/skills/index.d.ts +1 -1
- package/lib/views/skills/index.js +0 -3
- package/lib/views/skills/test/skills.test.d.ts +1 -0
- package/lib/views/skills/test/skills.test.js +94 -0
- package/lib/views/slides/index.d.ts +13 -2
- package/lib/views/slides/index.js +19 -15
- package/lib/views/slides/map-api-slide-to-ui.js +106 -99
- package/lib/views/slides/test/fixtures/free-text.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm-drag.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm-graphic.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm.d.ts +2 -1
- package/lib/views/slides/test/fixtures/slider.d.ts +2 -1
- package/lib/views/slides/test/fixtures/template.d.ts +4 -0
- package/{es/views/slides/test/fixtures/select-template.js → lib/views/slides/test/fixtures/template.js} +82 -4
- package/lib/views/slides/test/index.test.d.ts +1 -0
- package/lib/views/slides/test/index.test.js +473 -0
- package/lib/views/slides/test/map-api-slide-to-ui.test.js +4 -10
- package/lib/views/slides/test/slide.template.on-change.test.d.ts +1 -0
- package/lib/views/slides/test/slide.template.on-change.test.js +82 -0
- package/package.json +6 -5
- package/src/actions/api/fetch-skills.ts +18 -11
- package/src/actions/api/fetch-slide.ts +3 -1
- package/src/actions/api/post-answer.ts +44 -0
- package/src/actions/api/post-progression.ts +7 -4
- package/src/actions/api/test/fetch-skills.test.ts +9 -6
- package/src/actions/api/test/fetch-slide.test.ts +9 -6
- package/src/actions/api/test/post-answer.test.ts +101 -0
- package/src/actions/api/test/post-progression.test.ts +9 -6
- package/src/actions/data/test/token.test.ts +29 -0
- package/src/actions/index.ts +1 -17
- package/src/actions/{api/test → test}/create-test-store.ts +2 -2
- package/src/actions/ui/answers.ts +55 -6
- package/src/actions/ui/slides.ts +1 -8
- package/src/actions/ui/test/answers.test.ts +115 -0
- package/src/actions/ui/test/slides.test.ts +30 -0
- package/src/common/index.ts +0 -7
- package/src/index.tsx +1 -3
- package/src/reducers/data/progression.ts +4 -7
- package/src/reducers/data/slides.ts +2 -3
- package/src/reducers/data/test/progression.test.ts +15 -31
- package/src/reducers/ui/answers.ts +5 -9
- package/src/reducers/ui/index.ts +4 -1
- package/src/reducers/ui/slide.ts +43 -0
- package/src/reducers/ui/test/answers.test.ts +29 -4
- package/src/reducers/ui/test/current-slide-ref.test.ts +1 -1
- package/src/reducers/ui/test/navigation.test.ts +5 -5
- package/src/reducers/ui/test/slide.test.ts +15 -0
- package/src/test/util/services.mock.ts +94 -73
- package/src/types/common.ts +0 -30
- package/src/views/skills/index.ts +1 -5
- package/src/views/skills/test/skills.test.ts +101 -0
- package/src/views/slides/index.ts +38 -23
- package/src/views/slides/map-api-slide-to-ui.ts +146 -113
- package/src/views/slides/test/fixtures/free-text.ts +2 -1
- package/src/views/slides/test/fixtures/qcm-drag.ts +2 -1
- package/src/views/slides/test/fixtures/qcm-graphic.ts +2 -1
- package/src/views/slides/test/fixtures/qcm.ts +2 -1
- package/src/views/slides/test/fixtures/slider.ts +2 -1
- package/src/views/slides/test/fixtures/{select-template.ts → template.ts} +84 -5
- package/src/views/slides/test/index.test.ts +493 -0
- package/src/views/slides/test/map-api-slide-to-ui.test.ts +6 -11
- package/src/views/slides/test/slide.template.on-change.test.ts +92 -0
- package/es/fixtures/qcm-slide.d.ts +0 -2
- package/es/fixtures/qcm-slide.js +0 -33
- package/es/fixtures/temp-fixture.d.ts +0 -3
- package/es/fixtures/temp-fixture.js +0 -84
- package/es/views/slides/test/fixtures/select-template.d.ts +0 -3
- package/es/views/slides/test/fixtures/text-template.d.ts +0 -3
- package/es/views/slides/test/fixtures/text-template.js +0 -58
- package/lib/fixtures/qcm-slide.d.ts +0 -2
- package/lib/fixtures/qcm-slide.js +0 -33
- package/lib/fixtures/temp-fixture.d.ts +0 -3
- package/lib/fixtures/temp-fixture.js +0 -84
- package/lib/views/slides/test/fixtures/select-template.d.ts +0 -3
- package/lib/views/slides/test/fixtures/text-template.d.ts +0 -3
- package/lib/views/slides/test/fixtures/text-template.js +0 -58
- package/src/fixtures/qcm-slide.ts +0 -35
- package/src/fixtures/temp-fixture.ts +0 -94
- package/src/views/slides/test/fixtures/text-template.ts +0 -61
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import identity from 'lodash/fp/identity';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import { mapStateToSlidesProps } from '..';
|
|
5
|
+
import { freeTextSlide } from './fixtures/free-text';
|
|
6
|
+
test('should create initial props when fetched slide is still not received', function (t) {
|
|
7
|
+
var state = {
|
|
8
|
+
data: {
|
|
9
|
+
progression: {
|
|
10
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
11
|
+
content: {
|
|
12
|
+
ref: '_skillref',
|
|
13
|
+
type: 'skill'
|
|
14
|
+
},
|
|
15
|
+
engine: {
|
|
16
|
+
ref: 'review'
|
|
17
|
+
},
|
|
18
|
+
state: {
|
|
19
|
+
allAnswers: [],
|
|
20
|
+
isCorrect: true,
|
|
21
|
+
nextContent: {
|
|
22
|
+
ref: 'sli_N1XACJobn',
|
|
23
|
+
type: 'slide'
|
|
24
|
+
},
|
|
25
|
+
pendingSlides: [],
|
|
26
|
+
slides: [],
|
|
27
|
+
step: {
|
|
28
|
+
current: 1
|
|
29
|
+
},
|
|
30
|
+
stars: 0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
skills: [],
|
|
34
|
+
slides: {
|
|
35
|
+
sli_N1XACJobn: null
|
|
36
|
+
},
|
|
37
|
+
token: '1234'
|
|
38
|
+
},
|
|
39
|
+
ui: {
|
|
40
|
+
currentSlideRef: '',
|
|
41
|
+
navigation: ['loader', 'slides'],
|
|
42
|
+
answers: [],
|
|
43
|
+
slide: {
|
|
44
|
+
validateButton: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var props = mapStateToSlidesProps(state, identity);
|
|
49
|
+
t.is(props.congratsProps, undefined);
|
|
50
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
51
|
+
'aria-label': 'aria-header-wrapper',
|
|
52
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
53
|
+
mode: '__revision_mode',
|
|
54
|
+
skillName: '__agility',
|
|
55
|
+
steps: [
|
|
56
|
+
{
|
|
57
|
+
current: true,
|
|
58
|
+
icon: 'no-answer',
|
|
59
|
+
value: '1'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
current: false,
|
|
63
|
+
icon: 'no-answer',
|
|
64
|
+
value: '2'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
current: false,
|
|
68
|
+
icon: 'no-answer',
|
|
69
|
+
value: '3'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
current: false,
|
|
73
|
+
icon: 'no-answer',
|
|
74
|
+
value: '4'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
current: false,
|
|
78
|
+
icon: 'no-answer',
|
|
79
|
+
value: '5'
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
t.deepEqual(omit(['validateButton'], props.stack), {
|
|
84
|
+
correctionPopinProps: undefined,
|
|
85
|
+
endReview: false,
|
|
86
|
+
slides: {
|
|
87
|
+
'0': {
|
|
88
|
+
hidden: false,
|
|
89
|
+
position: 0,
|
|
90
|
+
loading: true
|
|
91
|
+
},
|
|
92
|
+
'1': {
|
|
93
|
+
hidden: false,
|
|
94
|
+
position: 1,
|
|
95
|
+
loading: true
|
|
96
|
+
},
|
|
97
|
+
'2': {
|
|
98
|
+
hidden: false,
|
|
99
|
+
position: 2,
|
|
100
|
+
loading: true
|
|
101
|
+
},
|
|
102
|
+
'3': {
|
|
103
|
+
hidden: false,
|
|
104
|
+
position: 3,
|
|
105
|
+
loading: true
|
|
106
|
+
},
|
|
107
|
+
'4': {
|
|
108
|
+
hidden: false,
|
|
109
|
+
position: 4,
|
|
110
|
+
loading: true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
test('should create initial props when the slide is on the state', function (t) {
|
|
116
|
+
var state = {
|
|
117
|
+
data: {
|
|
118
|
+
progression: {
|
|
119
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
120
|
+
content: {
|
|
121
|
+
ref: '_skillref',
|
|
122
|
+
type: 'skill'
|
|
123
|
+
},
|
|
124
|
+
engine: {
|
|
125
|
+
ref: 'review'
|
|
126
|
+
},
|
|
127
|
+
state: {
|
|
128
|
+
allAnswers: [],
|
|
129
|
+
isCorrect: true,
|
|
130
|
+
nextContent: {
|
|
131
|
+
ref: 'sli_N1XACJobn',
|
|
132
|
+
type: 'slide'
|
|
133
|
+
},
|
|
134
|
+
pendingSlides: [],
|
|
135
|
+
slides: [],
|
|
136
|
+
step: {
|
|
137
|
+
current: 1
|
|
138
|
+
},
|
|
139
|
+
stars: 0
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
skills: [],
|
|
143
|
+
slides: {
|
|
144
|
+
sli_N1XACJobn: freeTextSlide
|
|
145
|
+
},
|
|
146
|
+
token: '1234'
|
|
147
|
+
},
|
|
148
|
+
ui: {
|
|
149
|
+
currentSlideRef: 'sli_N1XACJobn',
|
|
150
|
+
navigation: ['loader', 'slides'],
|
|
151
|
+
answers: ['My value'],
|
|
152
|
+
slide: {
|
|
153
|
+
validateButton: true
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var props = mapStateToSlidesProps(state, identity);
|
|
158
|
+
t.is(props.congratsProps, undefined);
|
|
159
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
160
|
+
'aria-label': 'aria-header-wrapper',
|
|
161
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
162
|
+
mode: '__revision_mode',
|
|
163
|
+
skillName: '__agility',
|
|
164
|
+
steps: [
|
|
165
|
+
{
|
|
166
|
+
current: true,
|
|
167
|
+
icon: 'no-answer',
|
|
168
|
+
value: '1'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
current: false,
|
|
172
|
+
icon: 'no-answer',
|
|
173
|
+
value: '2'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
current: false,
|
|
177
|
+
icon: 'no-answer',
|
|
178
|
+
value: '3'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
current: false,
|
|
182
|
+
icon: 'no-answer',
|
|
183
|
+
value: '4'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
current: false,
|
|
187
|
+
icon: 'no-answer',
|
|
188
|
+
value: '5'
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
|
|
193
|
+
correctionPopinProps: undefined,
|
|
194
|
+
endReview: false
|
|
195
|
+
});
|
|
196
|
+
t.false(props.stack.validateButton.disabled);
|
|
197
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
198
|
+
hidden: false,
|
|
199
|
+
position: 0,
|
|
200
|
+
loading: false,
|
|
201
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
202
|
+
questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
|
|
203
|
+
});
|
|
204
|
+
t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
|
|
205
|
+
help: 'Type your answer.',
|
|
206
|
+
model: {
|
|
207
|
+
placeholder: 'Type here',
|
|
208
|
+
type: 'freeText',
|
|
209
|
+
value: 'My value'
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
t.deepEqual(omit(['0'], props.stack.slides), {
|
|
213
|
+
'1': {
|
|
214
|
+
hidden: false,
|
|
215
|
+
position: 1,
|
|
216
|
+
loading: true
|
|
217
|
+
},
|
|
218
|
+
'2': {
|
|
219
|
+
hidden: false,
|
|
220
|
+
position: 2,
|
|
221
|
+
loading: true
|
|
222
|
+
},
|
|
223
|
+
'3': {
|
|
224
|
+
hidden: false,
|
|
225
|
+
position: 3,
|
|
226
|
+
loading: true
|
|
227
|
+
},
|
|
228
|
+
'4': {
|
|
229
|
+
hidden: false,
|
|
230
|
+
position: 4,
|
|
231
|
+
loading: true
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
test('should create props when the next slide is on the state', function (t) {
|
|
236
|
+
var state = {
|
|
237
|
+
data: {
|
|
238
|
+
progression: {
|
|
239
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
240
|
+
content: {
|
|
241
|
+
ref: '_skill-ref',
|
|
242
|
+
type: 'skill'
|
|
243
|
+
},
|
|
244
|
+
engine: {
|
|
245
|
+
ref: 'review'
|
|
246
|
+
},
|
|
247
|
+
state: {
|
|
248
|
+
allAnswers: [
|
|
249
|
+
{
|
|
250
|
+
slideRef: 'sli_VJYjJnJhg',
|
|
251
|
+
isCorrect: true,
|
|
252
|
+
answer: ['Benchmark']
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
isCorrect: true,
|
|
256
|
+
nextContent: {
|
|
257
|
+
ref: 'sli_VkSQroQnx',
|
|
258
|
+
type: 'slide'
|
|
259
|
+
},
|
|
260
|
+
content: {
|
|
261
|
+
ref: 'sli_VJYjJnJhg',
|
|
262
|
+
type: 'slide'
|
|
263
|
+
},
|
|
264
|
+
pendingSlides: [],
|
|
265
|
+
slides: ['sli_VJYjJnJhg'],
|
|
266
|
+
step: {
|
|
267
|
+
current: 2
|
|
268
|
+
},
|
|
269
|
+
stars: 4
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
skills: [],
|
|
273
|
+
slides: {
|
|
274
|
+
sli_VJYjJnJhg: {
|
|
275
|
+
question: {
|
|
276
|
+
content: {
|
|
277
|
+
media: {
|
|
278
|
+
src: [],
|
|
279
|
+
posters: [],
|
|
280
|
+
subtitles: []
|
|
281
|
+
},
|
|
282
|
+
label: '',
|
|
283
|
+
placeholder: 'Type here',
|
|
284
|
+
id: 'sli_VJYjJnJhg.choice_1'
|
|
285
|
+
},
|
|
286
|
+
type: 'basic',
|
|
287
|
+
header: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?',
|
|
288
|
+
explanation: 'Type your answer.'
|
|
289
|
+
},
|
|
290
|
+
klf: 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.',
|
|
291
|
+
tips: 'According to Insee, Paris salaries are 20-25% higher compared with those of the provinces in 2015.',
|
|
292
|
+
universalRef: 'sli_VJYjJnJhg',
|
|
293
|
+
id: 'sli_VJYjJnJhg',
|
|
294
|
+
parentContentTitle: {
|
|
295
|
+
title: 'Developing the review app',
|
|
296
|
+
type: 'course'
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
sli_VkSQroQnx: {
|
|
300
|
+
question: {
|
|
301
|
+
content: {
|
|
302
|
+
media: {
|
|
303
|
+
src: [],
|
|
304
|
+
posters: [],
|
|
305
|
+
subtitles: []
|
|
306
|
+
},
|
|
307
|
+
choices: [
|
|
308
|
+
{
|
|
309
|
+
media: {
|
|
310
|
+
src: [
|
|
311
|
+
{
|
|
312
|
+
_id: '624efd915948a7013083e986',
|
|
313
|
+
mimeType: 'image/jpeg',
|
|
314
|
+
url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
|
|
315
|
+
id: '624efd915948a7013083e986'
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
posters: [],
|
|
319
|
+
subtitles: [],
|
|
320
|
+
type: 'img'
|
|
321
|
+
},
|
|
322
|
+
items: [],
|
|
323
|
+
_id: '624efd915948a7013083e985',
|
|
324
|
+
label: 'Vrai',
|
|
325
|
+
value: 'sli_VkSQroQnx.choice_NJesyUo7nx',
|
|
326
|
+
id: '624efd915948a7013083e985'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
media: {
|
|
330
|
+
src: [
|
|
331
|
+
{
|
|
332
|
+
_id: '624efd915948a7013083e988',
|
|
333
|
+
mimeType: 'image/jpeg',
|
|
334
|
+
url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
|
|
335
|
+
id: '624efd915948a7013083e988'
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
posters: [],
|
|
339
|
+
subtitles: [],
|
|
340
|
+
type: 'img'
|
|
341
|
+
},
|
|
342
|
+
items: [],
|
|
343
|
+
_id: '624efd915948a7013083e987',
|
|
344
|
+
label: 'Faux',
|
|
345
|
+
value: 'sli_VkSQroQnx.choice_VkgayLjX3e',
|
|
346
|
+
id: '624efd915948a7013083e987'
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
type: 'qcmGraphic',
|
|
351
|
+
header: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
|
|
352
|
+
explanation: 'Sélectionnez la bonne réponse.'
|
|
353
|
+
},
|
|
354
|
+
klf: "Il ne faut pas prendre la négociation comme une affaire personnelle, afin de rester centré sur son sujet. Mais cela ne signifie pas être dépourvu de toute émotion, car celles-ci peuvent être de vrais atouts. À condition de réussir à les exprimer sans accuser l'autre d'en être à l'origine.",
|
|
355
|
+
tips: "Pour gérer ses émotions, il faut d'abord les identifier, notamment en analysant ses ressentis physiques et en trouvant l'élément déclencheur.",
|
|
356
|
+
universalRef: 'sli_VkSQroQnx',
|
|
357
|
+
id: 'sli_VkSQroQnx',
|
|
358
|
+
parentContentTitle: {
|
|
359
|
+
title: 'Developing the review app',
|
|
360
|
+
type: 'course'
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
token: 'undefined'
|
|
365
|
+
},
|
|
366
|
+
ui: {
|
|
367
|
+
currentSlideRef: 'sli_VJYjJnJhg',
|
|
368
|
+
navigation: ['loader', 'slides'],
|
|
369
|
+
answers: ['My value'],
|
|
370
|
+
slide: {
|
|
371
|
+
validateButton: false
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
var props = mapStateToSlidesProps(state, identity);
|
|
376
|
+
t.is(props.congratsProps, undefined);
|
|
377
|
+
t.deepEqual(omit(['onQuitClick'], props.header), {
|
|
378
|
+
'aria-label': 'aria-header-wrapper',
|
|
379
|
+
closeButtonAriaLabel: 'aria-close-button',
|
|
380
|
+
mode: '__revision_mode',
|
|
381
|
+
skillName: '__agility',
|
|
382
|
+
steps: [
|
|
383
|
+
{
|
|
384
|
+
current: true,
|
|
385
|
+
icon: 'right',
|
|
386
|
+
value: '1'
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
// FIX ME: update on PR -> https://trello.com/c/qOSDa8Fm/2715-app-review-props-dynamiques-pour-les-step-items-du-header-bas%C3%A9-sur-le-state
|
|
390
|
+
current: true,
|
|
391
|
+
icon: 'no-answer',
|
|
392
|
+
value: '2'
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
current: false,
|
|
396
|
+
icon: 'no-answer',
|
|
397
|
+
value: '3'
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
current: false,
|
|
401
|
+
icon: 'no-answer',
|
|
402
|
+
value: '4'
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
current: false,
|
|
406
|
+
icon: 'no-answer',
|
|
407
|
+
value: '5'
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
|
|
412
|
+
correctionPopinProps: undefined,
|
|
413
|
+
endReview: false
|
|
414
|
+
});
|
|
415
|
+
t.true(props.stack.validateButton.disabled);
|
|
416
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
417
|
+
hidden: false,
|
|
418
|
+
position: 0,
|
|
419
|
+
loading: false,
|
|
420
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
421
|
+
questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
|
|
422
|
+
});
|
|
423
|
+
t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
|
|
424
|
+
help: 'Type your answer.',
|
|
425
|
+
model: {
|
|
426
|
+
placeholder: 'Type here',
|
|
427
|
+
type: 'freeText',
|
|
428
|
+
value: 'My value'
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
t.deepEqual(omit(['0', '1.answerUI.model.answers.0.onClick', '1.answerUI.model.answers.1.onClick'], props.stack.slides), {
|
|
432
|
+
'1': {
|
|
433
|
+
answerUI: {
|
|
434
|
+
help: 'Sélectionnez la bonne réponse.',
|
|
435
|
+
model: {
|
|
436
|
+
answers: [
|
|
437
|
+
{
|
|
438
|
+
image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
|
|
439
|
+
selected: false,
|
|
440
|
+
title: 'Vrai'
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
|
|
444
|
+
selected: false,
|
|
445
|
+
title: 'Faux'
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
type: 'qcmGraphic'
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
hidden: false,
|
|
452
|
+
loading: false,
|
|
453
|
+
position: 1,
|
|
454
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
455
|
+
questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
|
|
456
|
+
},
|
|
457
|
+
'2': {
|
|
458
|
+
hidden: false,
|
|
459
|
+
position: 2,
|
|
460
|
+
loading: true
|
|
461
|
+
},
|
|
462
|
+
'3': {
|
|
463
|
+
hidden: false,
|
|
464
|
+
position: 3,
|
|
465
|
+
loading: true
|
|
466
|
+
},
|
|
467
|
+
'4': {
|
|
468
|
+
hidden: false,
|
|
469
|
+
position: 4,
|
|
470
|
+
loading: true
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
});
|
|
@@ -16,8 +16,7 @@ import { qcmUISlide, qcmSlide } from './fixtures/qcm';
|
|
|
16
16
|
import { qcmDragUISlide, qcmDragSlide } from './fixtures/qcm-drag';
|
|
17
17
|
import { freeTextSlide, freeTextUISlide } from './fixtures/free-text';
|
|
18
18
|
import { qcmGraphicUISlide, qcmGraphicSlide } from './fixtures/qcm-graphic';
|
|
19
|
-
import {
|
|
20
|
-
import { selectTemplateSlide, selectTemplateUISlide } from './fixtures/select-template';
|
|
19
|
+
import { templateSlide, templateUISlide } from './fixtures/template';
|
|
21
20
|
import { sliderSlide, sliderUISlide } from './fixtures/slider';
|
|
22
21
|
var _mapApiSlideToUi = mapApiSlideToUi(identity);
|
|
23
22
|
var macro = test.macro({
|
|
@@ -35,15 +34,10 @@ test('qcm graphic', macro, {
|
|
|
35
34
|
answers: [],
|
|
36
35
|
expectedUiSlide: qcmGraphicUISlide
|
|
37
36
|
});
|
|
38
|
-
test('
|
|
39
|
-
slide:
|
|
37
|
+
test('template', macro, {
|
|
38
|
+
slide: templateSlide,
|
|
40
39
|
answers: [],
|
|
41
|
-
expectedUiSlide:
|
|
42
|
-
});
|
|
43
|
-
test('select template', macro, {
|
|
44
|
-
slide: selectTemplateSlide,
|
|
45
|
-
answers: [],
|
|
46
|
-
expectedUiSlide: selectTemplateUISlide
|
|
40
|
+
expectedUiSlide: templateUISlide
|
|
47
41
|
});
|
|
48
42
|
test('free text', macro, { slide: freeTextSlide, answers: [], expectedUiSlide: freeTextUISlide });
|
|
49
43
|
test('slider', macro, { slide: sliderSlide, answers: [], expectedUiSlide: sliderUISlide });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import { mapStateToSlidesProps } from '..';
|
|
6
|
+
import { services } from '../../../test/util/services.mock';
|
|
7
|
+
import { createTestStore } from '../../../actions/test/create-test-store';
|
|
8
|
+
import { EDIT_TEMPLATE } from '../../../actions/ui/answers';
|
|
9
|
+
import { templateSlide } from './fixtures/template';
|
|
10
|
+
var progression = {
|
|
11
|
+
_id: '123456789123',
|
|
12
|
+
content: { type: 'skill', ref: '_skill-ref' },
|
|
13
|
+
engine: {
|
|
14
|
+
ref: 'review'
|
|
15
|
+
},
|
|
16
|
+
state: {
|
|
17
|
+
allAnswers: [],
|
|
18
|
+
isCorrect: true,
|
|
19
|
+
nextContent: {
|
|
20
|
+
ref: templateSlide.id,
|
|
21
|
+
type: 'slide'
|
|
22
|
+
},
|
|
23
|
+
pendingSlides: [],
|
|
24
|
+
slides: [],
|
|
25
|
+
step: {
|
|
26
|
+
current: 1
|
|
27
|
+
},
|
|
28
|
+
stars: 0
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var initialState = {
|
|
32
|
+
data: {
|
|
33
|
+
progression: progression,
|
|
34
|
+
slides: (_a = {},
|
|
35
|
+
_a[templateSlide.id] = templateSlide,
|
|
36
|
+
_a),
|
|
37
|
+
skills: [],
|
|
38
|
+
token: '1234'
|
|
39
|
+
},
|
|
40
|
+
ui: {
|
|
41
|
+
currentSlideRef: templateSlide.id,
|
|
42
|
+
navigation: ['skills', 'slides'],
|
|
43
|
+
answers: [],
|
|
44
|
+
slide: {
|
|
45
|
+
validateButton: false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Text slide', function (t) {
|
|
50
|
+
var _a;
|
|
51
|
+
t.plan(2);
|
|
52
|
+
var expectedActions = [{ type: EDIT_TEMPLATE, payload: ['', 'test', ''] }];
|
|
53
|
+
var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
|
|
54
|
+
var props = mapStateToSlidesProps(getState(), dispatch);
|
|
55
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
56
|
+
hidden: false,
|
|
57
|
+
position: 0,
|
|
58
|
+
loading: false,
|
|
59
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
60
|
+
questionText: 'Complétez la phrase ci-dessous.'
|
|
61
|
+
});
|
|
62
|
+
var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
|
|
63
|
+
var onChange = get(['1', 'onChange'], SlideProps.answers);
|
|
64
|
+
onChange('test');
|
|
65
|
+
});
|
|
66
|
+
test('should dispatch EDIT_TEMPLATE action via the property onChange of a Template Select slide', function (t) {
|
|
67
|
+
var _a;
|
|
68
|
+
t.plan(2);
|
|
69
|
+
var expectedActions = [{ type: EDIT_TEMPLATE, payload: ['Catalogue', '', ''] }];
|
|
70
|
+
var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
|
|
71
|
+
var props = mapStateToSlidesProps(getState(), dispatch);
|
|
72
|
+
t.deepEqual(omit('answerUI', props.stack.slides['0']), {
|
|
73
|
+
hidden: false,
|
|
74
|
+
position: 0,
|
|
75
|
+
loading: false,
|
|
76
|
+
parentContentTitle: 'From "Developing the review app" course',
|
|
77
|
+
questionText: 'Complétez la phrase ci-dessous.'
|
|
78
|
+
});
|
|
79
|
+
var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
|
|
80
|
+
var onChange = get(['0', 'onChange'], SlideProps.answers);
|
|
81
|
+
onChange('Catalogue');
|
|
82
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"clean:es": "rm -rf es",
|
|
19
19
|
"clean": "concurrently \"npm run clean:commonjs\" \"npm run clean:es\"",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
|
-
"
|
|
21
|
+
"ava": "ava",
|
|
22
|
+
"test:unit": "nyc npm run ava",
|
|
22
23
|
"lint": "eslint '**/*' --cache --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json",
|
|
23
24
|
"lint:fix": "npm run lint -- --fix",
|
|
24
25
|
"test": "npm run lint && npm run typecheck && npm run test:unit"
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"./package.json": "./package.json"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@coorpacademy/components": "10.22.
|
|
44
|
+
"@coorpacademy/components": "10.22.12",
|
|
44
45
|
"@coorpacademy/redux-task": "^1.1.5",
|
|
45
46
|
"cross-fetch": "^3.1.5",
|
|
46
47
|
"jwt-decode": "^3.1.2",
|
|
@@ -74,8 +75,8 @@
|
|
|
74
75
|
"nock": "^13.2.9",
|
|
75
76
|
"postcss-modules-values-replace": "^3.4.0",
|
|
76
77
|
"react-dom": "^17.0.2",
|
|
77
|
-
"ts-node": "^10.
|
|
78
|
+
"ts-node": "^10.9.1",
|
|
78
79
|
"typescript": "^4.7.4"
|
|
79
80
|
},
|
|
80
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "2b9abf8c945cd56a6a47091836e4961917580782"
|
|
81
82
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
-
import
|
|
2
|
+
import get from 'lodash/fp/get';
|
|
3
|
+
import type {Dispatch} from 'redux';
|
|
3
4
|
import type {StoreState} from '../../reducers';
|
|
4
|
-
import {Options, Skill} from '../../types/common';
|
|
5
|
+
import type {Options, Skill} from '../../types/common';
|
|
5
6
|
|
|
6
7
|
export const SKILLS_FETCH_REQUEST = '@@skills/FETCH_REQUEST' as const;
|
|
7
8
|
export const SKILLS_FETCH_SUCCESS = '@@skills/FETCH_SUCCESS' as const;
|
|
@@ -12,13 +13,19 @@ export type ReceivedSkills = {
|
|
|
12
13
|
payload: Skill[];
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export const fetchSkills =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export const fetchSkills = async (
|
|
17
|
+
dispatch: Dispatch,
|
|
18
|
+
getState: () => StoreState,
|
|
19
|
+
{services}: Options
|
|
20
|
+
): Promise<void> => {
|
|
21
|
+
const action = buildTask({
|
|
22
|
+
types: [SKILLS_FETCH_REQUEST, SKILLS_FETCH_SUCCESS, SKILLS_FETCH_FAILURE],
|
|
23
|
+
task: () => {
|
|
24
|
+
const state = getState();
|
|
25
|
+
const token = get('data.token', state);
|
|
26
|
+
return services.fetchSkills(token);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
await dispatch(action);
|
|
31
|
+
};
|
|
@@ -23,7 +23,7 @@ export type ReceivedSlide = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const fetchSlide =
|
|
26
|
-
(slideRef: string
|
|
26
|
+
(slideRef: string) =>
|
|
27
27
|
async (dispatch: Dispatch, getState: () => StoreState, {services}: Options): Promise<void> => {
|
|
28
28
|
const action = buildTask({
|
|
29
29
|
types: [SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS, SLIDE_FETCH_FAILURE],
|
|
@@ -31,6 +31,8 @@ export const fetchSlide =
|
|
|
31
31
|
return has(`data.slide.${slideRef}`, state);
|
|
32
32
|
},
|
|
33
33
|
task: () => {
|
|
34
|
+
const state = getState();
|
|
35
|
+
const token = get('data.token', state);
|
|
34
36
|
return services.fetchSlide(slideRef, token);
|
|
35
37
|
},
|
|
36
38
|
meta: {slideRef}
|