scorm-again 1.7.1 → 2.0.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/.babelrc +18 -7
- package/.github/dependabot.yml +5 -0
- package/.github/workflows/main.yml +79 -0
- package/.jsdoc.json +4 -5
- package/.mocharc.json +8 -0
- package/.run/Mocha Unit Tests.run.xml +5 -2
- package/CONTRIBUTING.md +1 -1
- package/README.md +14 -1
- package/dist/aicc.js +3661 -7170
- package/dist/aicc.js.map +1 -1
- package/dist/aicc.min.js +2 -40
- package/dist/aicc.min.js.map +1 -0
- package/dist/scorm-again.js +5671 -10695
- package/dist/scorm-again.js.map +1 -1
- package/dist/scorm-again.min.js +2 -52
- package/dist/scorm-again.min.js.map +1 -0
- package/dist/scorm12.js +2871 -5433
- package/dist/scorm12.js.map +1 -1
- package/dist/scorm12.min.js +2 -34
- package/dist/scorm12.min.js.map +1 -0
- package/dist/scorm2004.js +3868 -6797
- package/dist/scorm2004.js.map +1 -1
- package/dist/scorm2004.min.js +2 -40
- package/dist/scorm2004.min.js.map +1 -0
- package/eslint.config.js +21 -0
- package/package.json +72 -34
- package/results.json +34254 -0
- package/src/{AICC.js → AICC.ts} +27 -21
- package/src/BaseAPI.ts +1449 -0
- package/src/Scorm12API.ts +360 -0
- package/src/{Scorm2004API.js → Scorm2004API.ts} +245 -163
- package/src/cmi/aicc_cmi.ts +1248 -0
- package/src/cmi/common.ts +411 -0
- package/src/cmi/scorm12_cmi.ts +1426 -0
- package/src/cmi/scorm2004_cmi.ts +1874 -0
- package/src/constants/api_constants.ts +318 -0
- package/src/constants/error_codes.ts +88 -0
- package/src/constants/language_constants.ts +394 -0
- package/src/constants/regex.ts +97 -0
- package/src/constants/{response_constants.js → response_constants.ts} +67 -62
- package/src/exceptions.ts +133 -0
- package/src/exports/aicc.js +1 -1
- package/src/exports/scorm-again.js +3 -3
- package/src/exports/scorm12.js +1 -1
- package/src/exports/scorm2004.js +1 -1
- package/src/{utilities.js → utilities.ts} +114 -74
- package/tea.yaml +6 -0
- package/test/{AICC.spec.js → AICC.spec.ts} +70 -72
- package/test/Scorm12API.spec.ts +580 -0
- package/test/Scorm2004API.spec.ts +812 -0
- package/test/api_helpers.ts +176 -0
- package/test/cmi/{aicc_cmi.spec.js → aicc_cmi.spec.ts} +193 -209
- package/test/cmi/{scorm12_cmi.spec.js → scorm12_cmi.spec.ts} +251 -269
- package/test/cmi/scorm2004_cmi.spec.ts +1031 -0
- package/test/cmi_helpers.ts +207 -0
- package/test/exceptions.spec.ts +79 -0
- package/test/field_values.ts +202 -0
- package/test/utilities.spec.ts +322 -0
- package/tsconfig.json +18 -0
- package/webpack.config.js +65 -0
- package/.circleci/config.yml +0 -99
- package/.codeclimate.yml +0 -7
- package/.eslintrc.js +0 -36
- package/src/.flowconfig +0 -11
- package/src/BaseAPI.js +0 -1275
- package/src/Scorm12API.js +0 -308
- package/src/cmi/aicc_cmi.js +0 -1141
- package/src/cmi/common.js +0 -328
- package/src/cmi/scorm12_cmi.js +0 -1312
- package/src/cmi/scorm2004_cmi.js +0 -1692
- package/src/constants/api_constants.js +0 -218
- package/src/constants/error_codes.js +0 -87
- package/src/constants/language_constants.js +0 -76
- package/src/constants/regex.js +0 -84
- package/src/exceptions.js +0 -104
- package/test/Scorm12API.spec.js +0 -528
- package/test/Scorm2004API.spec.js +0 -775
- package/test/abstract_classes.spec.js +0 -17
- package/test/api_helpers.js +0 -128
- package/test/cmi/scorm2004_cmi.spec.js +0 -1066
- package/test/cmi_helpers.js +0 -161
- package/test/exceptions.spec.js +0 -71
- package/test/field_values.js +0 -353
- package/test/utilities.spec.js +0 -339
- package/webpack.js +0 -78
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {expect} from
|
|
2
|
-
import {describe, it} from
|
|
3
|
-
import APIConstants from
|
|
4
|
-
import ErrorCodes from
|
|
1
|
+
import { expect } from "expect";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import APIConstants from "../../src/constants/api_constants";
|
|
4
|
+
import ErrorCodes from "../../src/constants/error_codes";
|
|
5
5
|
import {
|
|
6
6
|
CMI,
|
|
7
7
|
CMIInteractionsCorrectResponsesObject,
|
|
8
8
|
CMIInteractionsObject,
|
|
9
9
|
CMIInteractionsObjectivesObject,
|
|
10
10
|
CMIObjectivesObject,
|
|
11
|
-
} from
|
|
12
|
-
import * as h from
|
|
13
|
-
import {
|
|
11
|
+
} from "../../src/cmi/scorm12_cmi";
|
|
12
|
+
import * as h from "../cmi_helpers";
|
|
13
|
+
import { scorm12Values } from "../field_values";
|
|
14
14
|
|
|
15
15
|
const scorm12 = APIConstants.scorm12;
|
|
16
16
|
const scorm12_error_codes = ErrorCodes.scorm12;
|
|
@@ -46,86 +46,86 @@ const objective = () => {
|
|
|
46
46
|
return new CMIObjectivesObject();
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
describe(
|
|
50
|
-
describe(
|
|
49
|
+
describe("SCORM 1.2 CMI Tests", () => {
|
|
50
|
+
describe("getCurrentTotalTime()", () => {
|
|
51
51
|
h.checkGetCurrentTotalTime({
|
|
52
52
|
cmi: cmi(),
|
|
53
|
-
startingTotal:
|
|
54
|
-
sessionTime:
|
|
55
|
-
expectedTotal:
|
|
56
|
-
totalFieldName:
|
|
57
|
-
sessionFieldName:
|
|
53
|
+
startingTotal: "00:00:00",
|
|
54
|
+
sessionTime: "00:15:45",
|
|
55
|
+
expectedTotal: "00:15:45",
|
|
56
|
+
totalFieldName: "cmi.core.total_time",
|
|
57
|
+
sessionFieldName: "cmi.core.session_time",
|
|
58
58
|
});
|
|
59
59
|
h.checkGetCurrentTotalTime({
|
|
60
60
|
cmi: cmi(),
|
|
61
|
-
startingTotal:
|
|
62
|
-
sessionTime:
|
|
63
|
-
expectedTotal:
|
|
64
|
-
totalFieldName:
|
|
65
|
-
sessionFieldName:
|
|
61
|
+
startingTotal: "00:01:00",
|
|
62
|
+
sessionTime: "00:15:45",
|
|
63
|
+
expectedTotal: "00:16:45",
|
|
64
|
+
totalFieldName: "cmi.core.total_time",
|
|
65
|
+
sessionFieldName: "cmi.core.session_time",
|
|
66
66
|
});
|
|
67
67
|
h.checkGetCurrentTotalTime({
|
|
68
68
|
cmi: cmi(),
|
|
69
|
-
startingTotal:
|
|
70
|
-
sessionTime:
|
|
71
|
-
expectedTotal:
|
|
72
|
-
totalFieldName:
|
|
73
|
-
sessionFieldName:
|
|
69
|
+
startingTotal: "00:01:00",
|
|
70
|
+
sessionTime: "00:00:00",
|
|
71
|
+
expectedTotal: "00:01:00",
|
|
72
|
+
totalFieldName: "cmi.core.total_time",
|
|
73
|
+
sessionFieldName: "cmi.core.session_time",
|
|
74
74
|
});
|
|
75
75
|
h.checkGetCurrentTotalTime({
|
|
76
76
|
cmi: cmi(),
|
|
77
|
-
startingTotal:
|
|
78
|
-
sessionTime:
|
|
79
|
-
expectedTotal:
|
|
80
|
-
totalFieldName:
|
|
81
|
-
sessionFieldName:
|
|
77
|
+
startingTotal: "25:01:00",
|
|
78
|
+
sessionTime: "13:00:00",
|
|
79
|
+
expectedTotal: "38:01:00",
|
|
80
|
+
totalFieldName: "cmi.core.total_time",
|
|
81
|
+
sessionFieldName: "cmi.core.session_time",
|
|
82
82
|
});
|
|
83
83
|
h.checkGetCurrentTotalTime({
|
|
84
84
|
cmi: cmi(),
|
|
85
|
-
startingTotal:
|
|
86
|
-
sessionTime:
|
|
87
|
-
expectedTotal:
|
|
88
|
-
totalFieldName:
|
|
89
|
-
sessionFieldName:
|
|
85
|
+
startingTotal: "48:01:45",
|
|
86
|
+
sessionTime: "13:00:16",
|
|
87
|
+
expectedTotal: "61:02:01",
|
|
88
|
+
totalFieldName: "cmi.core.total_time",
|
|
89
|
+
sessionFieldName: "cmi.core.session_time",
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
describe(
|
|
94
|
-
describe(
|
|
93
|
+
describe("CMI Spec Tests", () => {
|
|
94
|
+
describe("Pre-Initialize Tests", () => {
|
|
95
95
|
/**
|
|
96
96
|
* Base CMI Properties
|
|
97
97
|
*/
|
|
98
98
|
h.checkReadOnly({
|
|
99
99
|
cmi: cmi(),
|
|
100
|
-
fieldName:
|
|
101
|
-
expectedValue:
|
|
100
|
+
fieldName: "cmi._version",
|
|
101
|
+
expectedValue: "3.4",
|
|
102
102
|
expectedError: invalid_set,
|
|
103
103
|
});
|
|
104
104
|
h.checkReadOnly({
|
|
105
105
|
cmi: cmi(),
|
|
106
|
-
fieldName:
|
|
106
|
+
fieldName: "cmi._children",
|
|
107
107
|
expectedValue: scorm12.cmi_children,
|
|
108
108
|
expectedError: invalid_set,
|
|
109
109
|
});
|
|
110
110
|
h.checkFieldConstraintSize({
|
|
111
111
|
cmi: cmi(),
|
|
112
|
-
fieldName:
|
|
112
|
+
fieldName: "cmi.suspend_data",
|
|
113
113
|
limit: 4096,
|
|
114
114
|
expectedError: type_mismatch,
|
|
115
115
|
});
|
|
116
116
|
h.checkReadAndWrite({
|
|
117
117
|
cmi: cmi(),
|
|
118
|
-
fieldName:
|
|
118
|
+
fieldName: "cmi.launch_data",
|
|
119
119
|
});
|
|
120
120
|
h.checkFieldConstraintSize({
|
|
121
121
|
cmi: cmi(),
|
|
122
|
-
fieldName:
|
|
122
|
+
fieldName: "cmi.comments",
|
|
123
123
|
limit: 4096,
|
|
124
124
|
expectedError: type_mismatch,
|
|
125
125
|
});
|
|
126
126
|
h.checkReadAndWrite({
|
|
127
127
|
cmi: cmi(),
|
|
128
|
-
fieldName:
|
|
128
|
+
fieldName: "cmi.comments_from_lms",
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
/**
|
|
@@ -133,74 +133,74 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
133
133
|
*/
|
|
134
134
|
h.checkReadOnly({
|
|
135
135
|
cmi: cmi(),
|
|
136
|
-
fieldName:
|
|
136
|
+
fieldName: "cmi.core._children",
|
|
137
137
|
expectedValue: scorm12.core_children,
|
|
138
138
|
expectedError: invalid_set,
|
|
139
139
|
});
|
|
140
140
|
h.checkReadAndWrite({
|
|
141
141
|
cmi: cmi(),
|
|
142
|
-
fieldName:
|
|
142
|
+
fieldName: "cmi.core.student_id",
|
|
143
143
|
});
|
|
144
144
|
h.checkReadAndWrite({
|
|
145
145
|
cmi: cmi(),
|
|
146
|
-
fieldName:
|
|
146
|
+
fieldName: "cmi.core.student_name",
|
|
147
147
|
});
|
|
148
148
|
h.checkFieldConstraintSize({
|
|
149
149
|
cmi: cmi(),
|
|
150
|
-
fieldName:
|
|
150
|
+
fieldName: "cmi.core.lesson_location",
|
|
151
151
|
limit: 255,
|
|
152
152
|
expectedError: type_mismatch,
|
|
153
153
|
});
|
|
154
154
|
h.checkReadAndWrite({
|
|
155
155
|
cmi: cmi(),
|
|
156
|
-
fieldName:
|
|
156
|
+
fieldName: "cmi.core.credit",
|
|
157
157
|
});
|
|
158
158
|
h.checkRead({
|
|
159
159
|
cmi: cmi(),
|
|
160
|
-
fieldName:
|
|
161
|
-
expectedValue:
|
|
160
|
+
fieldName: "cmi.core.lesson_status",
|
|
161
|
+
expectedValue: "not attempted",
|
|
162
162
|
});
|
|
163
163
|
h.checkValidValues({
|
|
164
164
|
cmi: cmi(),
|
|
165
|
-
fieldName:
|
|
166
|
-
validValues:
|
|
167
|
-
invalidValues:
|
|
165
|
+
fieldName: "cmi.core.lesson_status",
|
|
166
|
+
validValues: scorm12Values.validLessonStatus,
|
|
167
|
+
invalidValues: scorm12Values.invalidLessonStatus,
|
|
168
168
|
});
|
|
169
169
|
h.checkReadAndWrite({
|
|
170
170
|
cmi: cmi(),
|
|
171
|
-
fieldName:
|
|
171
|
+
fieldName: "cmi.core.entry",
|
|
172
172
|
});
|
|
173
173
|
h.checkReadAndWrite({
|
|
174
174
|
cmi: cmi(),
|
|
175
|
-
fieldName:
|
|
175
|
+
fieldName: "cmi.core.total_time",
|
|
176
176
|
});
|
|
177
177
|
h.checkReadAndWrite({
|
|
178
178
|
cmi: cmi(),
|
|
179
|
-
fieldName:
|
|
180
|
-
expectedValue:
|
|
179
|
+
fieldName: "cmi.core.lesson_mode",
|
|
180
|
+
expectedValue: "normal",
|
|
181
181
|
});
|
|
182
182
|
h.checkWrite({
|
|
183
183
|
cmi: cmi(),
|
|
184
|
-
fieldName:
|
|
185
|
-
valueToTest:
|
|
184
|
+
fieldName: "cmi.core.exit",
|
|
185
|
+
valueToTest: "suspend",
|
|
186
186
|
});
|
|
187
187
|
h.checkValidValues({
|
|
188
188
|
cmi: cmi(),
|
|
189
|
-
fieldName:
|
|
190
|
-
validValues:
|
|
191
|
-
invalidValues:
|
|
189
|
+
fieldName: "cmi.core.exit",
|
|
190
|
+
validValues: scorm12Values.validExit,
|
|
191
|
+
invalidValues: scorm12Values.invalidExit,
|
|
192
192
|
});
|
|
193
193
|
h.checkWriteOnly({
|
|
194
194
|
cmi: cmi(),
|
|
195
|
-
fieldName:
|
|
196
|
-
valueToTest:
|
|
195
|
+
fieldName: "cmi.core.session_time",
|
|
196
|
+
valueToTest: "00:00:00",
|
|
197
197
|
expectedError: write_only,
|
|
198
198
|
});
|
|
199
199
|
h.checkValidValues({
|
|
200
200
|
cmi: cmi(),
|
|
201
|
-
fieldName:
|
|
202
|
-
validValues:
|
|
203
|
-
invalidValues:
|
|
201
|
+
fieldName: "cmi.core.session_time",
|
|
202
|
+
validValues: scorm12Values.validTimespan,
|
|
203
|
+
invalidValues: scorm12Values.invalidTimespan,
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
/**
|
|
@@ -208,40 +208,40 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
208
208
|
*/
|
|
209
209
|
h.checkReadOnly({
|
|
210
210
|
cmi: cmi(),
|
|
211
|
-
fieldName:
|
|
211
|
+
fieldName: "cmi.core.score._children",
|
|
212
212
|
expectedValue: scorm12.score_children,
|
|
213
213
|
expectedError: invalid_set,
|
|
214
214
|
});
|
|
215
215
|
h.checkRead({
|
|
216
216
|
cmi: cmi(),
|
|
217
|
-
fieldName:
|
|
217
|
+
fieldName: "cmi.core.score.raw",
|
|
218
218
|
});
|
|
219
219
|
h.checkValidValues({
|
|
220
220
|
cmi: cmi(),
|
|
221
|
-
fieldName:
|
|
222
|
-
validValues:
|
|
223
|
-
invalidValues:
|
|
221
|
+
fieldName: "cmi.core.score.raw",
|
|
222
|
+
validValues: scorm12Values.validScoreRange,
|
|
223
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
224
224
|
});
|
|
225
225
|
h.checkRead({
|
|
226
226
|
cmi: cmi(),
|
|
227
|
-
fieldName:
|
|
227
|
+
fieldName: "cmi.core.score.min",
|
|
228
228
|
});
|
|
229
229
|
h.checkValidValues({
|
|
230
230
|
cmi: cmi(),
|
|
231
|
-
fieldName:
|
|
232
|
-
validValues:
|
|
233
|
-
invalidValues:
|
|
231
|
+
fieldName: "cmi.core.score.min",
|
|
232
|
+
validValues: scorm12Values.validScoreRange,
|
|
233
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
234
234
|
});
|
|
235
235
|
h.checkRead({
|
|
236
236
|
cmi: cmi(),
|
|
237
|
-
fieldName:
|
|
238
|
-
expectedValue:
|
|
237
|
+
fieldName: "cmi.core.score.max",
|
|
238
|
+
expectedValue: "100",
|
|
239
239
|
});
|
|
240
240
|
h.checkValidValues({
|
|
241
241
|
cmi: cmi(),
|
|
242
|
-
fieldName:
|
|
243
|
-
validValues:
|
|
244
|
-
invalidValues:
|
|
242
|
+
fieldName: "cmi.core.score.max",
|
|
243
|
+
validValues: scorm12Values.validScoreRange,
|
|
244
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
/**
|
|
@@ -249,13 +249,13 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
249
249
|
*/
|
|
250
250
|
h.checkReadOnly({
|
|
251
251
|
cmi: cmi(),
|
|
252
|
-
fieldName:
|
|
252
|
+
fieldName: "cmi.objectives._children",
|
|
253
253
|
expectedValue: scorm12.objectives_children,
|
|
254
254
|
expectedError: invalid_set,
|
|
255
255
|
});
|
|
256
256
|
h.checkReadOnly({
|
|
257
257
|
cmi: cmi(),
|
|
258
|
-
fieldName:
|
|
258
|
+
fieldName: "cmi.objectives._count",
|
|
259
259
|
expectedValue: 0,
|
|
260
260
|
expectedError: invalid_set,
|
|
261
261
|
});
|
|
@@ -265,21 +265,21 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
265
265
|
*/
|
|
266
266
|
h.checkReadOnly({
|
|
267
267
|
cmi: cmi(),
|
|
268
|
-
fieldName:
|
|
268
|
+
fieldName: "cmi.student_data._children",
|
|
269
269
|
expectedValue: scorm12.student_data_children,
|
|
270
270
|
expectedError: invalid_set,
|
|
271
271
|
});
|
|
272
272
|
h.checkReadAndWrite({
|
|
273
273
|
cmi: cmi(),
|
|
274
|
-
fieldName:
|
|
274
|
+
fieldName: "cmi.student_data.mastery_score",
|
|
275
275
|
});
|
|
276
276
|
h.checkReadAndWrite({
|
|
277
277
|
cmi: cmi(),
|
|
278
|
-
fieldName:
|
|
278
|
+
fieldName: "cmi.student_data.max_time_allowed",
|
|
279
279
|
});
|
|
280
280
|
h.checkReadAndWrite({
|
|
281
281
|
cmi: cmi(),
|
|
282
|
-
fieldName:
|
|
282
|
+
fieldName: "cmi.student_data.time_limit_action",
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
/**
|
|
@@ -287,47 +287,45 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
287
287
|
*/
|
|
288
288
|
h.checkReadOnly({
|
|
289
289
|
cmi: cmi(),
|
|
290
|
-
fieldName:
|
|
290
|
+
fieldName: "cmi.student_preference._children",
|
|
291
291
|
expectedValue: scorm12.student_preference_children,
|
|
292
292
|
expectedError: invalid_set,
|
|
293
293
|
});
|
|
294
294
|
h.checkRead({
|
|
295
295
|
cmi: cmi(),
|
|
296
|
-
fieldName:
|
|
296
|
+
fieldName: "cmi.student_preference.audio",
|
|
297
297
|
});
|
|
298
298
|
h.checkValidValues({
|
|
299
299
|
cmi: cmi(),
|
|
300
|
-
fieldName:
|
|
301
|
-
validValues:
|
|
302
|
-
|
|
303
|
-
]),
|
|
304
|
-
invalidValues: scorm12_values.invalid0To100Range,
|
|
300
|
+
fieldName: "cmi.student_preference.audio",
|
|
301
|
+
validValues: scorm12Values.valid0To100Range.concat(["-1"]),
|
|
302
|
+
invalidValues: scorm12Values.invalid0To100Range,
|
|
305
303
|
});
|
|
306
304
|
h.checkFieldConstraintSize({
|
|
307
305
|
cmi: cmi(),
|
|
308
|
-
fieldName:
|
|
306
|
+
fieldName: "cmi.student_preference.language",
|
|
309
307
|
limit: 255,
|
|
310
308
|
expectedError: type_mismatch,
|
|
311
309
|
});
|
|
312
310
|
h.checkRead({
|
|
313
311
|
cmi: cmi(),
|
|
314
|
-
fieldName:
|
|
312
|
+
fieldName: "cmi.student_preference.speed",
|
|
315
313
|
});
|
|
316
314
|
h.checkValidValues({
|
|
317
315
|
cmi: cmi(),
|
|
318
|
-
fieldName:
|
|
319
|
-
validValues:
|
|
320
|
-
invalidValues:
|
|
316
|
+
fieldName: "cmi.student_preference.speed",
|
|
317
|
+
validValues: scorm12Values.validSpeedRange,
|
|
318
|
+
invalidValues: scorm12Values.invalidSpeedRange,
|
|
321
319
|
});
|
|
322
320
|
h.checkRead({
|
|
323
321
|
cmi: cmi(),
|
|
324
|
-
fieldName:
|
|
322
|
+
fieldName: "cmi.student_preference.text",
|
|
325
323
|
});
|
|
326
324
|
h.checkValidValues({
|
|
327
325
|
cmi: cmi(),
|
|
328
|
-
fieldName:
|
|
329
|
-
validValues:
|
|
330
|
-
invalidValues:
|
|
326
|
+
fieldName: "cmi.student_preference.text",
|
|
327
|
+
validValues: scorm12Values.validIntegerScaledRange,
|
|
328
|
+
invalidValues: scorm12Values.invalidIntegerScaledRange,
|
|
331
329
|
});
|
|
332
330
|
|
|
333
331
|
/**
|
|
@@ -335,70 +333,70 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
335
333
|
*/
|
|
336
334
|
h.checkReadOnly({
|
|
337
335
|
cmi: cmi(),
|
|
338
|
-
fieldName:
|
|
336
|
+
fieldName: "cmi.interactions._children",
|
|
339
337
|
expectedValue: scorm12.interactions_children,
|
|
340
338
|
expectedError: invalid_set,
|
|
341
339
|
});
|
|
342
340
|
h.checkReadOnly({
|
|
343
341
|
cmi: cmi(),
|
|
344
|
-
fieldName:
|
|
342
|
+
fieldName: "cmi.interactions._count",
|
|
345
343
|
expectedValue: 0,
|
|
346
344
|
expectedError: invalid_set,
|
|
347
345
|
});
|
|
348
346
|
});
|
|
349
347
|
|
|
350
|
-
describe(
|
|
348
|
+
describe("Post-Initialize Tests", () => {
|
|
351
349
|
/**
|
|
352
350
|
* Base CMI Properties
|
|
353
351
|
*/
|
|
354
352
|
h.checkReadOnly({
|
|
355
353
|
cmi: cmiInitialized(),
|
|
356
|
-
fieldName:
|
|
357
|
-
expectedValue:
|
|
354
|
+
fieldName: "cmi._version",
|
|
355
|
+
expectedValue: "3.4",
|
|
358
356
|
expectedError: invalid_set,
|
|
359
357
|
});
|
|
360
358
|
h.checkReadOnly({
|
|
361
359
|
cmi: cmiInitialized(),
|
|
362
|
-
fieldName:
|
|
360
|
+
fieldName: "cmi._children",
|
|
363
361
|
expectedValue: scorm12.cmi_children,
|
|
364
362
|
expectedError: invalid_set,
|
|
365
363
|
});
|
|
366
364
|
h.checkFieldConstraintSize({
|
|
367
365
|
cmi: cmiInitialized(),
|
|
368
|
-
fieldName:
|
|
366
|
+
fieldName: "cmi.suspend_data",
|
|
369
367
|
limit: 4096,
|
|
370
368
|
expectedError: type_mismatch,
|
|
371
369
|
});
|
|
372
370
|
h.checkWrite({
|
|
373
371
|
cmi: cmiInitialized(),
|
|
374
|
-
fieldName:
|
|
375
|
-
valueToTest:
|
|
372
|
+
fieldName: "cmi.suspend_data",
|
|
373
|
+
valueToTest: "",
|
|
376
374
|
});
|
|
377
375
|
h.checkFieldConstraintSize({
|
|
378
376
|
cmi: cmiInitialized(),
|
|
379
|
-
fieldName:
|
|
377
|
+
fieldName: "cmi.core.suspend_data",
|
|
380
378
|
limit: 4096,
|
|
381
379
|
expectedError: type_mismatch,
|
|
382
380
|
});
|
|
383
381
|
h.checkWrite({
|
|
384
382
|
cmi: cmiInitialized(),
|
|
385
|
-
fieldName:
|
|
386
|
-
valueToTest:
|
|
383
|
+
fieldName: "cmi.core.suspend_data",
|
|
384
|
+
valueToTest: "",
|
|
387
385
|
});
|
|
388
386
|
h.checkReadOnly({
|
|
389
387
|
cmi: cmiInitialized(),
|
|
390
|
-
fieldName:
|
|
388
|
+
fieldName: "cmi.launch_data",
|
|
391
389
|
expectedError: read_only,
|
|
392
390
|
});
|
|
393
391
|
h.checkFieldConstraintSize({
|
|
394
392
|
cmi: cmiInitialized(),
|
|
395
|
-
fieldName:
|
|
393
|
+
fieldName: "cmi.comments",
|
|
396
394
|
limit: 4096,
|
|
397
395
|
expectedError: type_mismatch,
|
|
398
396
|
});
|
|
399
397
|
h.checkReadOnly({
|
|
400
398
|
cmi: cmiInitialized(),
|
|
401
|
-
fieldName:
|
|
399
|
+
fieldName: "cmi.comments_from_lms",
|
|
402
400
|
expectedError: read_only,
|
|
403
401
|
});
|
|
404
402
|
|
|
@@ -407,95 +405,93 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
407
405
|
*/
|
|
408
406
|
h.checkReadOnly({
|
|
409
407
|
cmi: cmiInitialized(),
|
|
410
|
-
fieldName:
|
|
408
|
+
fieldName: "cmi.core._children",
|
|
411
409
|
expectedValue: scorm12.core_children,
|
|
412
410
|
expectedError: invalid_set,
|
|
413
411
|
});
|
|
414
412
|
h.checkReadOnly({
|
|
415
413
|
cmi: cmiInitialized(),
|
|
416
|
-
fieldName:
|
|
414
|
+
fieldName: "cmi.core.student_id",
|
|
417
415
|
expectedError: read_only,
|
|
418
416
|
});
|
|
419
417
|
h.checkReadOnly({
|
|
420
418
|
cmi: cmiInitialized(),
|
|
421
|
-
fieldName:
|
|
419
|
+
fieldName: "cmi.core.student_name",
|
|
422
420
|
expectedError: read_only,
|
|
423
421
|
});
|
|
424
422
|
h.checkFieldConstraintSize({
|
|
425
423
|
cmi: cmiInitialized(),
|
|
426
|
-
fieldName:
|
|
424
|
+
fieldName: "cmi.core.lesson_location",
|
|
427
425
|
limit: 255,
|
|
428
426
|
expectedError: type_mismatch,
|
|
429
427
|
});
|
|
430
428
|
h.checkReadOnly({
|
|
431
429
|
cmi: cmiInitialized(),
|
|
432
|
-
fieldName:
|
|
430
|
+
fieldName: "cmi.core.credit",
|
|
433
431
|
expectedError: read_only,
|
|
434
432
|
});
|
|
435
433
|
h.checkRead({
|
|
436
434
|
cmi: cmiInitialized(),
|
|
437
|
-
fieldName:
|
|
438
|
-
expectedValue:
|
|
435
|
+
fieldName: "cmi.core.lesson_status",
|
|
436
|
+
expectedValue: "not attempted",
|
|
439
437
|
});
|
|
440
438
|
h.checkWrite({
|
|
441
439
|
cmi: cmi(),
|
|
442
|
-
fieldName:
|
|
443
|
-
valueToTest:
|
|
440
|
+
fieldName: "cmi.core.lesson_status",
|
|
441
|
+
valueToTest: "not attempted",
|
|
444
442
|
});
|
|
445
443
|
h.checkValidValues({
|
|
446
444
|
cmi: cmi(),
|
|
447
|
-
fieldName:
|
|
448
|
-
validValues:
|
|
449
|
-
|
|
450
|
-
]),
|
|
451
|
-
invalidValues: scorm12_values.invalidLessonStatus,
|
|
445
|
+
fieldName: "cmi.core.lesson_status",
|
|
446
|
+
validValues: scorm12Values.validLessonStatus.concat(["not attempted"]),
|
|
447
|
+
invalidValues: scorm12Values.invalidLessonStatus,
|
|
452
448
|
});
|
|
453
449
|
h.checkValidValues({
|
|
454
450
|
cmi: cmiInitialized(),
|
|
455
|
-
fieldName:
|
|
456
|
-
validValues:
|
|
457
|
-
invalidValues:
|
|
458
|
-
|
|
451
|
+
fieldName: "cmi.core.lesson_status",
|
|
452
|
+
validValues: scorm12Values.validLessonStatus,
|
|
453
|
+
invalidValues: scorm12Values.invalidLessonStatus.concat([
|
|
454
|
+
"not attempted",
|
|
459
455
|
]),
|
|
460
456
|
});
|
|
461
457
|
h.checkReadOnly({
|
|
462
458
|
cmi: cmiInitialized(),
|
|
463
|
-
fieldName:
|
|
459
|
+
fieldName: "cmi.core.entry",
|
|
464
460
|
expectedError: read_only,
|
|
465
461
|
});
|
|
466
462
|
h.checkReadOnly({
|
|
467
463
|
cmi: cmiInitialized(),
|
|
468
|
-
fieldName:
|
|
464
|
+
fieldName: "cmi.core.total_time",
|
|
469
465
|
expectedError: read_only,
|
|
470
466
|
});
|
|
471
467
|
h.checkReadOnly({
|
|
472
468
|
cmi: cmiInitialized(),
|
|
473
|
-
fieldName:
|
|
474
|
-
expectedValue:
|
|
469
|
+
fieldName: "cmi.core.lesson_mode",
|
|
470
|
+
expectedValue: "normal",
|
|
475
471
|
expectedError: read_only,
|
|
476
472
|
});
|
|
477
473
|
h.checkWrite({
|
|
478
474
|
cmi: cmiInitialized(),
|
|
479
|
-
fieldName:
|
|
480
|
-
valueToTest:
|
|
475
|
+
fieldName: "cmi.core.exit",
|
|
476
|
+
valueToTest: "suspend",
|
|
481
477
|
});
|
|
482
478
|
h.checkValidValues({
|
|
483
479
|
cmi: cmiInitialized(),
|
|
484
|
-
fieldName:
|
|
485
|
-
validValues:
|
|
486
|
-
invalidValues:
|
|
480
|
+
fieldName: "cmi.core.exit",
|
|
481
|
+
validValues: scorm12Values.validExit,
|
|
482
|
+
invalidValues: scorm12Values.invalidExit,
|
|
487
483
|
});
|
|
488
484
|
h.checkWriteOnly({
|
|
489
485
|
cmi: cmiInitialized(),
|
|
490
|
-
fieldName:
|
|
491
|
-
valueToTest:
|
|
486
|
+
fieldName: "cmi.core.session_time",
|
|
487
|
+
valueToTest: "00:00:00",
|
|
492
488
|
expectedError: write_only,
|
|
493
489
|
});
|
|
494
490
|
h.checkValidValues({
|
|
495
491
|
cmi: cmiInitialized(),
|
|
496
|
-
fieldName:
|
|
497
|
-
validValues:
|
|
498
|
-
invalidValues:
|
|
492
|
+
fieldName: "cmi.core.session_time",
|
|
493
|
+
validValues: scorm12Values.validTimespan,
|
|
494
|
+
invalidValues: scorm12Values.invalidTimespan,
|
|
499
495
|
});
|
|
500
496
|
|
|
501
497
|
/**
|
|
@@ -503,27 +499,27 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
503
499
|
*/
|
|
504
500
|
h.checkReadOnly({
|
|
505
501
|
cmi: cmiInitialized(),
|
|
506
|
-
fieldName:
|
|
502
|
+
fieldName: "cmi.core.score._children",
|
|
507
503
|
expectedValue: scorm12.score_children,
|
|
508
504
|
expectedError: invalid_set,
|
|
509
505
|
});
|
|
510
506
|
h.checkValidValues({
|
|
511
507
|
cmi: cmiInitialized(),
|
|
512
|
-
fieldName:
|
|
513
|
-
validValues:
|
|
514
|
-
invalidValues:
|
|
508
|
+
fieldName: "cmi.core.score.raw",
|
|
509
|
+
validValues: scorm12Values.validScoreRange,
|
|
510
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
515
511
|
});
|
|
516
512
|
h.checkValidValues({
|
|
517
513
|
cmi: cmiInitialized(),
|
|
518
|
-
fieldName:
|
|
519
|
-
validValues:
|
|
520
|
-
invalidValues:
|
|
514
|
+
fieldName: "cmi.core.score.min",
|
|
515
|
+
validValues: scorm12Values.validScoreRange,
|
|
516
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
521
517
|
});
|
|
522
518
|
h.checkValidValues({
|
|
523
519
|
cmi: cmiInitialized(),
|
|
524
|
-
fieldName:
|
|
525
|
-
validValues:
|
|
526
|
-
invalidValues:
|
|
520
|
+
fieldName: "cmi.core.score.max",
|
|
521
|
+
validValues: scorm12Values.validScoreRange,
|
|
522
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
527
523
|
});
|
|
528
524
|
|
|
529
525
|
/**
|
|
@@ -531,13 +527,13 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
531
527
|
*/
|
|
532
528
|
h.checkReadOnly({
|
|
533
529
|
cmi: cmiInitialized(),
|
|
534
|
-
fieldName:
|
|
530
|
+
fieldName: "cmi.objectives._children",
|
|
535
531
|
expectedValue: scorm12.objectives_children,
|
|
536
532
|
expectedError: invalid_set,
|
|
537
533
|
});
|
|
538
534
|
h.checkReadOnly({
|
|
539
535
|
cmi: cmiInitialized(),
|
|
540
|
-
fieldName:
|
|
536
|
+
fieldName: "cmi.objectives._count",
|
|
541
537
|
expectedValue: 0,
|
|
542
538
|
expectedError: invalid_set,
|
|
543
539
|
});
|
|
@@ -547,23 +543,23 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
547
543
|
*/
|
|
548
544
|
h.checkReadOnly({
|
|
549
545
|
cmi: cmiInitialized(),
|
|
550
|
-
fieldName:
|
|
546
|
+
fieldName: "cmi.student_data._children",
|
|
551
547
|
expectedValue: scorm12.student_data_children,
|
|
552
548
|
expectedError: invalid_set,
|
|
553
549
|
});
|
|
554
550
|
h.checkReadOnly({
|
|
555
551
|
cmi: cmiInitialized(),
|
|
556
|
-
fieldName:
|
|
552
|
+
fieldName: "cmi.student_data.mastery_score",
|
|
557
553
|
expectedError: read_only,
|
|
558
554
|
});
|
|
559
555
|
h.checkReadOnly({
|
|
560
556
|
cmi: cmiInitialized(),
|
|
561
|
-
fieldName:
|
|
557
|
+
fieldName: "cmi.student_data.max_time_allowed",
|
|
562
558
|
expectedError: read_only,
|
|
563
559
|
});
|
|
564
560
|
h.checkReadOnly({
|
|
565
561
|
cmi: cmiInitialized(),
|
|
566
|
-
fieldName:
|
|
562
|
+
fieldName: "cmi.student_data.time_limit_action",
|
|
567
563
|
expectedError: read_only,
|
|
568
564
|
});
|
|
569
565
|
|
|
@@ -572,33 +568,33 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
572
568
|
*/
|
|
573
569
|
h.checkReadOnly({
|
|
574
570
|
cmi: cmiInitialized(),
|
|
575
|
-
fieldName:
|
|
571
|
+
fieldName: "cmi.student_preference._children",
|
|
576
572
|
expectedValue: scorm12.student_preference_children,
|
|
577
573
|
expectedError: invalid_set,
|
|
578
574
|
});
|
|
579
575
|
h.checkValidValues({
|
|
580
576
|
cmi: cmiInitialized(),
|
|
581
|
-
fieldName:
|
|
582
|
-
validValues:
|
|
583
|
-
invalidValues:
|
|
577
|
+
fieldName: "cmi.student_preference.audio",
|
|
578
|
+
validValues: scorm12Values.valid0To100Range.concat(["-1"]),
|
|
579
|
+
invalidValues: scorm12Values.invalid0To100Range,
|
|
584
580
|
});
|
|
585
581
|
h.checkFieldConstraintSize({
|
|
586
582
|
cmi: cmiInitialized(),
|
|
587
|
-
fieldName:
|
|
583
|
+
fieldName: "cmi.student_preference.language",
|
|
588
584
|
limit: 255,
|
|
589
585
|
expectedError: type_mismatch,
|
|
590
586
|
});
|
|
591
587
|
h.checkValidValues({
|
|
592
588
|
cmi: cmiInitialized(),
|
|
593
|
-
fieldName:
|
|
594
|
-
validValues:
|
|
595
|
-
invalidValues:
|
|
589
|
+
fieldName: "cmi.student_preference.speed",
|
|
590
|
+
validValues: scorm12Values.validSpeedRange,
|
|
591
|
+
invalidValues: scorm12Values.invalidSpeedRange,
|
|
596
592
|
});
|
|
597
593
|
h.checkValidValues({
|
|
598
594
|
cmi: cmiInitialized(),
|
|
599
|
-
fieldName:
|
|
600
|
-
validValues:
|
|
601
|
-
invalidValues:
|
|
595
|
+
fieldName: "cmi.student_preference.text",
|
|
596
|
+
validValues: scorm12Values.validIntegerScaledRange,
|
|
597
|
+
invalidValues: scorm12Values.invalidIntegerScaledRange,
|
|
602
598
|
});
|
|
603
599
|
|
|
604
600
|
/**
|
|
@@ -606,194 +602,183 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
606
602
|
*/
|
|
607
603
|
h.checkReadOnly({
|
|
608
604
|
cmi: cmiInitialized(),
|
|
609
|
-
fieldName:
|
|
605
|
+
fieldName: "cmi.interactions._children",
|
|
610
606
|
expectedValue: scorm12.interactions_children,
|
|
611
607
|
expectedError: invalid_set,
|
|
612
608
|
});
|
|
613
609
|
h.checkReadOnly({
|
|
614
610
|
cmi: cmiInitialized(),
|
|
615
|
-
fieldName:
|
|
611
|
+
fieldName: "cmi.interactions._count",
|
|
616
612
|
expectedValue: 0,
|
|
617
613
|
expectedError: invalid_set,
|
|
618
614
|
});
|
|
619
615
|
|
|
620
|
-
it(
|
|
616
|
+
it("should export JSON", () => {
|
|
621
617
|
const cmiObj = cmiInitialized();
|
|
622
618
|
cmiObj.objectives.childArray.push(new CMIObjectivesObject());
|
|
623
619
|
cmiObj.interactions.childArray.push(new CMIInteractionsObject());
|
|
624
|
-
expect(
|
|
625
|
-
|
|
626
|
-
)
|
|
627
|
-
to.
|
|
628
|
-
equal(
|
|
629
|
-
'{"suspend_data":"","launch_data":"","comments":"","comments_from_lms":"","core":{"student_id":"","student_name":"","lesson_location":"","credit":"","lesson_status":"not attempted","entry":"","lesson_mode":"normal","exit":"","session_time":"00:00:00","score":{"raw":"","min":"","max":"100"}},"objectives":{"0":{"id":"","status":"","score":{"raw":"","min":"","max":"100"}}},"student_data":{"mastery_score":"","max_time_allowed":"","time_limit_action":""},"student_preference":{"audio":"","language":"","speed":"","text":""},"interactions":{"0":{"id":"","time":"","type":"","weighting":"","student_response":"","result":"","latency":"","objectives":{},"correct_responses":{}}}}');
|
|
620
|
+
expect(JSON.stringify(cmiObj)).toEqual(
|
|
621
|
+
'{"suspend_data":"","launch_data":"","comments":"","comments_from_lms":"","core":{"student_id":"","student_name":"","lesson_location":"","credit":"","lesson_status":"not attempted","entry":"","lesson_mode":"normal","exit":"","session_time":"00:00:00","score":{"raw":"","min":"","max":"100"}},"objectives":{"0":{"id":"","status":"","score":{"raw":"","min":"","max":"100"}}},"student_data":{"mastery_score":"","max_time_allowed":"","time_limit_action":""},"student_preference":{"audio":"","language":"","speed":"","text":""},"interactions":{"0":{"id":"","time":"","type":"","weighting":"","student_response":"","result":"","latency":"","objectives":{},"correct_responses":{}}}}',
|
|
622
|
+
);
|
|
630
623
|
});
|
|
631
624
|
});
|
|
632
625
|
|
|
633
|
-
describe(
|
|
626
|
+
describe("CMIInteractionsObject Tests", () => {
|
|
634
627
|
/**
|
|
635
628
|
* cmi.interactions.n object
|
|
636
629
|
*/
|
|
637
630
|
h.checkWriteOnly({
|
|
638
631
|
cmi: interaction(),
|
|
639
|
-
fieldName:
|
|
632
|
+
fieldName: "cmi.id",
|
|
640
633
|
expectedError: write_only,
|
|
641
634
|
});
|
|
642
635
|
h.checkWriteOnly({
|
|
643
636
|
cmi: interactionInitialized(),
|
|
644
|
-
fieldName:
|
|
637
|
+
fieldName: "cmi.id",
|
|
645
638
|
expectedError: write_only,
|
|
646
639
|
});
|
|
647
640
|
h.checkWriteOnly({
|
|
648
641
|
cmi: interaction(),
|
|
649
|
-
fieldName:
|
|
642
|
+
fieldName: "cmi.time",
|
|
650
643
|
expectedError: write_only,
|
|
651
|
-
valueToTest:
|
|
644
|
+
valueToTest: "23:59:59",
|
|
652
645
|
});
|
|
653
646
|
h.checkValidValues({
|
|
654
647
|
cmi: interaction(),
|
|
655
|
-
fieldName:
|
|
656
|
-
validValues:
|
|
657
|
-
invalidValues:
|
|
648
|
+
fieldName: "cmi.time",
|
|
649
|
+
validValues: scorm12Values.validTime,
|
|
650
|
+
invalidValues: scorm12Values.invalidTime,
|
|
658
651
|
});
|
|
659
652
|
h.checkWriteOnly({
|
|
660
653
|
cmi: interaction(),
|
|
661
|
-
fieldName:
|
|
654
|
+
fieldName: "cmi.type",
|
|
662
655
|
expectedError: write_only,
|
|
663
|
-
valueToTest:
|
|
656
|
+
valueToTest: "true-false",
|
|
664
657
|
});
|
|
665
658
|
h.checkValidValues({
|
|
666
659
|
cmi: interaction(),
|
|
667
|
-
fieldName:
|
|
668
|
-
validValues:
|
|
669
|
-
invalidValues:
|
|
660
|
+
fieldName: "cmi.type",
|
|
661
|
+
validValues: scorm12Values.validType,
|
|
662
|
+
invalidValues: scorm12Values.invalidType,
|
|
670
663
|
});
|
|
671
664
|
h.checkReadOnly({
|
|
672
665
|
cmi: interaction(),
|
|
673
|
-
fieldName:
|
|
666
|
+
fieldName: "cmi.objectives._count",
|
|
674
667
|
expectedValue: 0,
|
|
675
668
|
expectedError: invalid_set,
|
|
676
669
|
});
|
|
677
670
|
h.checkReadOnly({
|
|
678
671
|
cmi: interaction(),
|
|
679
|
-
fieldName:
|
|
672
|
+
fieldName: "cmi.correct_responses._count",
|
|
680
673
|
expectedValue: 0,
|
|
681
674
|
expectedError: invalid_set,
|
|
682
675
|
});
|
|
683
676
|
h.checkWriteOnly({
|
|
684
677
|
cmi: interaction(),
|
|
685
|
-
fieldName:
|
|
678
|
+
fieldName: "cmi.weighting",
|
|
686
679
|
expectedError: write_only,
|
|
687
|
-
valueToTest:
|
|
680
|
+
valueToTest: "0",
|
|
688
681
|
});
|
|
689
682
|
h.checkValidValues({
|
|
690
683
|
cmi: interaction(),
|
|
691
|
-
fieldName:
|
|
692
|
-
validValues:
|
|
693
|
-
invalidValues:
|
|
684
|
+
fieldName: "cmi.weighting",
|
|
685
|
+
validValues: scorm12Values.validSpeedRange,
|
|
686
|
+
invalidValues: scorm12Values.invalidSpeedRange,
|
|
694
687
|
});
|
|
695
688
|
h.checkWriteOnly({
|
|
696
689
|
cmi: interaction(),
|
|
697
|
-
fieldName:
|
|
690
|
+
fieldName: "cmi.student_response",
|
|
698
691
|
expectedError: write_only,
|
|
699
692
|
});
|
|
700
693
|
h.checkWriteOnly({
|
|
701
694
|
cmi: interaction(),
|
|
702
|
-
fieldName:
|
|
695
|
+
fieldName: "cmi.result",
|
|
703
696
|
expectedError: write_only,
|
|
704
|
-
valueToTest:
|
|
697
|
+
valueToTest: "correct",
|
|
705
698
|
});
|
|
706
699
|
h.checkValidValues({
|
|
707
700
|
cmi: interaction(),
|
|
708
|
-
fieldName:
|
|
709
|
-
validValues:
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
701
|
+
fieldName: "cmi.result",
|
|
702
|
+
validValues: scorm12Values.validResult.concat([
|
|
703
|
+
"1",
|
|
704
|
+
"999",
|
|
705
|
+
"999.99999",
|
|
713
706
|
]),
|
|
714
|
-
invalidValues:
|
|
707
|
+
invalidValues: scorm12Values.invalidResult,
|
|
715
708
|
});
|
|
716
709
|
h.checkWriteOnly({
|
|
717
710
|
cmi: interaction(),
|
|
718
|
-
fieldName:
|
|
719
|
-
valueToTest:
|
|
711
|
+
fieldName: "cmi.latency",
|
|
712
|
+
valueToTest: "00:00:00",
|
|
720
713
|
expectedError: write_only,
|
|
721
714
|
});
|
|
722
715
|
h.checkValidValues({
|
|
723
716
|
cmi: interaction(),
|
|
724
|
-
fieldName:
|
|
725
|
-
validValues:
|
|
726
|
-
invalidValues:
|
|
717
|
+
fieldName: "cmi.latency",
|
|
718
|
+
validValues: scorm12Values.validTimespan,
|
|
719
|
+
invalidValues: scorm12Values.invalidTimespan,
|
|
727
720
|
});
|
|
728
721
|
|
|
729
|
-
it(
|
|
722
|
+
it("should export JSON", () => {
|
|
730
723
|
const cmi = interaction();
|
|
731
724
|
cmi.objectives.childArray.push(new CMIInteractionsObjectivesObject());
|
|
732
725
|
cmi.correct_responses.childArray.push(
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
equal(
|
|
739
|
-
'{"id":"","time":"","type":"","weighting":"","student_response":"","result":"","latency":"","objectives":{"0":{"id":""}},"correct_responses":{"0":{"pattern":""}}}');
|
|
726
|
+
new CMIInteractionsCorrectResponsesObject(),
|
|
727
|
+
);
|
|
728
|
+
expect(JSON.stringify(cmi)).toEqual(
|
|
729
|
+
'{"id":"","time":"","type":"","weighting":"","student_response":"","result":"","latency":"","objectives":{"0":{"id":""}},"correct_responses":{"0":{"pattern":""}}}',
|
|
730
|
+
);
|
|
740
731
|
});
|
|
741
732
|
});
|
|
742
733
|
|
|
743
|
-
describe(
|
|
734
|
+
describe("CMIInteractionsObjectivesObject Tests", () => {
|
|
744
735
|
/**
|
|
745
736
|
* cmi.interactions.n.objectives.n object
|
|
746
737
|
*/
|
|
747
738
|
h.checkReadAndWrite({
|
|
748
739
|
cmi: interactionObjective(),
|
|
749
|
-
fieldName:
|
|
740
|
+
fieldName: "cmi.id",
|
|
750
741
|
});
|
|
751
742
|
|
|
752
|
-
it(
|
|
743
|
+
it("should export JSON", () => {
|
|
753
744
|
const cmi = interactionObjective();
|
|
754
|
-
expect(
|
|
755
|
-
JSON.stringify(cmi),
|
|
756
|
-
).to.equal('{"id":""}');
|
|
745
|
+
expect(JSON.stringify(cmi)).toEqual('{"id":""}');
|
|
757
746
|
});
|
|
758
747
|
});
|
|
759
748
|
|
|
760
|
-
describe(
|
|
749
|
+
describe("CMIInteractionsCorrectResponsesObject Tests", () => {
|
|
761
750
|
/**
|
|
762
751
|
* cmi.interactions.n.correct_responses.n object
|
|
763
752
|
*/
|
|
764
753
|
h.checkWriteOnly({
|
|
765
754
|
cmi: correctResponse(),
|
|
766
|
-
fieldName:
|
|
755
|
+
fieldName: "cmi.pattern",
|
|
767
756
|
expectedError: write_only,
|
|
768
757
|
});
|
|
769
758
|
|
|
770
|
-
it(
|
|
759
|
+
it("should export JSON", () => {
|
|
771
760
|
const cmi = correctResponse();
|
|
772
|
-
expect(
|
|
773
|
-
JSON.stringify(cmi),
|
|
774
|
-
).to.equal('{"pattern":""}');
|
|
761
|
+
expect(JSON.stringify(cmi)).toEqual('{"pattern":""}');
|
|
775
762
|
});
|
|
776
763
|
});
|
|
777
764
|
|
|
778
|
-
describe(
|
|
765
|
+
describe("CMIObjectivesObject Tests", () => {
|
|
779
766
|
/**
|
|
780
767
|
* cmi.objectives.n object
|
|
781
768
|
*/
|
|
782
769
|
h.checkReadAndWrite({
|
|
783
770
|
cmi: objective(),
|
|
784
|
-
fieldName:
|
|
771
|
+
fieldName: "cmi.id",
|
|
785
772
|
});
|
|
786
773
|
h.checkRead({
|
|
787
774
|
cmi: objective(),
|
|
788
|
-
fieldName:
|
|
775
|
+
fieldName: "cmi.status",
|
|
789
776
|
});
|
|
790
777
|
h.checkValidValues({
|
|
791
778
|
cmi: objective(),
|
|
792
|
-
fieldName:
|
|
793
|
-
validValues:
|
|
794
|
-
|
|
795
|
-
]),
|
|
796
|
-
invalidValues: scorm12_values.invalidLessonStatus,
|
|
779
|
+
fieldName: "cmi.status",
|
|
780
|
+
validValues: scorm12Values.validLessonStatus.concat(["not attempted"]),
|
|
781
|
+
invalidValues: scorm12Values.invalidLessonStatus,
|
|
797
782
|
});
|
|
798
783
|
|
|
799
784
|
/**
|
|
@@ -801,50 +786,47 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|
|
801
786
|
*/
|
|
802
787
|
h.checkReadOnly({
|
|
803
788
|
cmi: objective(),
|
|
804
|
-
fieldName:
|
|
789
|
+
fieldName: "cmi.score._children",
|
|
805
790
|
expectedValue: scorm12.score_children,
|
|
806
791
|
expectedError: invalid_set,
|
|
807
792
|
});
|
|
808
793
|
h.checkRead({
|
|
809
794
|
cmi: objective(),
|
|
810
|
-
fieldName:
|
|
795
|
+
fieldName: "cmi.score.raw",
|
|
811
796
|
});
|
|
812
797
|
h.checkValidValues({
|
|
813
798
|
cmi: objective(),
|
|
814
|
-
fieldName:
|
|
815
|
-
validValues:
|
|
816
|
-
invalidValues:
|
|
799
|
+
fieldName: "cmi.score.raw",
|
|
800
|
+
validValues: scorm12Values.validScoreRange,
|
|
801
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
817
802
|
});
|
|
818
803
|
h.checkRead({
|
|
819
804
|
cmi: objective(),
|
|
820
|
-
fieldName:
|
|
805
|
+
fieldName: "cmi.score.min",
|
|
821
806
|
});
|
|
822
807
|
h.checkValidValues({
|
|
823
808
|
cmi: objective(),
|
|
824
|
-
fieldName:
|
|
825
|
-
validValues:
|
|
826
|
-
invalidValues:
|
|
809
|
+
fieldName: "cmi.score.min",
|
|
810
|
+
validValues: scorm12Values.validScoreRange,
|
|
811
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
827
812
|
});
|
|
828
813
|
h.checkRead({
|
|
829
814
|
cmi: objective(),
|
|
830
|
-
fieldName:
|
|
831
|
-
expectedValue:
|
|
815
|
+
fieldName: "cmi.score.max",
|
|
816
|
+
expectedValue: "100",
|
|
832
817
|
});
|
|
833
818
|
h.checkValidValues({
|
|
834
819
|
cmi: objective(),
|
|
835
|
-
fieldName:
|
|
836
|
-
validValues:
|
|
837
|
-
invalidValues:
|
|
820
|
+
fieldName: "cmi.score.max",
|
|
821
|
+
validValues: scorm12Values.validScoreRange,
|
|
822
|
+
invalidValues: scorm12Values.invalidScoreRange,
|
|
838
823
|
});
|
|
839
824
|
|
|
840
|
-
it(
|
|
825
|
+
it("should export JSON", () => {
|
|
841
826
|
const cmi = objective();
|
|
842
|
-
expect(
|
|
843
|
-
|
|
844
|
-
)
|
|
845
|
-
to.
|
|
846
|
-
equal(
|
|
847
|
-
'{"id":"","status":"","score":{"raw":"","min":"","max":"100"}}');
|
|
827
|
+
expect(JSON.stringify(cmi)).toEqual(
|
|
828
|
+
'{"id":"","status":"","score":{"raw":"","min":"","max":"100"}}',
|
|
829
|
+
);
|
|
848
830
|
});
|
|
849
831
|
});
|
|
850
832
|
});
|