scorm-again 1.7.1 → 2.1.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.
Files changed (124) hide show
  1. package/.babelrc +18 -7
  2. package/.github/dependabot.yml +5 -0
  3. package/.github/workflows/main.yml +79 -0
  4. package/.github/workflows/stale.yml +14 -0
  5. package/.jsdoc.json +4 -5
  6. package/.mocharc.json +8 -0
  7. package/.run/{Mocha Unit Tests.run.xml → Mocha Unit Tests (watch).run.xml } +6 -3
  8. package/.run/Template Mocha.run.xml +17 -0
  9. package/CONTRIBUTING.md +1 -1
  10. package/README.md +183 -71
  11. package/dist/aicc.js +3822 -7030
  12. package/dist/aicc.js.map +1 -1
  13. package/dist/aicc.min.js +2 -40
  14. package/dist/aicc.min.js.map +1 -0
  15. package/dist/scorm-again.js +5965 -10498
  16. package/dist/scorm-again.js.map +1 -1
  17. package/dist/scorm-again.min.js +2 -52
  18. package/dist/scorm-again.min.js.map +1 -0
  19. package/dist/scorm12.js +3028 -5373
  20. package/dist/scorm12.js.map +1 -1
  21. package/dist/scorm12.min.js +2 -34
  22. package/dist/scorm12.min.js.map +1 -0
  23. package/dist/scorm2004.js +4054 -6693
  24. package/dist/scorm2004.js.map +1 -1
  25. package/dist/scorm2004.min.js +2 -40
  26. package/dist/scorm2004.min.js.map +1 -0
  27. package/eslint.config.js +21 -0
  28. package/package.json +76 -34
  29. package/results.json +34254 -0
  30. package/src/AICC.ts +72 -0
  31. package/src/BaseAPI.ts +1300 -0
  32. package/src/Scorm12API.ts +387 -0
  33. package/src/Scorm2004API.ts +688 -0
  34. package/src/cmi/aicc/attempts.ts +94 -0
  35. package/src/cmi/aicc/cmi.ts +100 -0
  36. package/src/cmi/aicc/core.ts +360 -0
  37. package/src/cmi/aicc/evaluation.ts +157 -0
  38. package/src/cmi/aicc/paths.ts +180 -0
  39. package/src/cmi/aicc/student_data.ts +86 -0
  40. package/src/cmi/aicc/student_demographics.ts +367 -0
  41. package/src/cmi/aicc/student_preferences.ts +176 -0
  42. package/src/cmi/aicc/tries.ts +116 -0
  43. package/src/cmi/aicc/validation.ts +25 -0
  44. package/src/cmi/common/array.ts +77 -0
  45. package/src/cmi/common/base_cmi.ts +46 -0
  46. package/src/cmi/common/score.ts +203 -0
  47. package/src/cmi/common/validation.ts +60 -0
  48. package/src/cmi/scorm12/cmi.ts +224 -0
  49. package/src/cmi/scorm12/interactions.ts +368 -0
  50. package/src/cmi/scorm12/nav.ts +54 -0
  51. package/src/cmi/scorm12/objectives.ts +112 -0
  52. package/src/cmi/scorm12/student_data.ts +130 -0
  53. package/src/cmi/scorm12/student_preference.ts +158 -0
  54. package/src/cmi/scorm12/validation.ts +48 -0
  55. package/src/cmi/scorm2004/adl.ts +272 -0
  56. package/src/cmi/scorm2004/cmi.ts +599 -0
  57. package/src/cmi/scorm2004/comments.ts +163 -0
  58. package/src/cmi/scorm2004/interactions.ts +466 -0
  59. package/src/cmi/scorm2004/learner_preference.ts +152 -0
  60. package/src/cmi/scorm2004/objectives.ts +212 -0
  61. package/src/cmi/scorm2004/score.ts +78 -0
  62. package/src/cmi/scorm2004/validation.ts +42 -0
  63. package/src/constants/api_constants.ts +318 -0
  64. package/src/constants/default_settings.ts +81 -0
  65. package/src/constants/enums.ts +5 -0
  66. package/src/constants/error_codes.ts +88 -0
  67. package/src/constants/language_constants.ts +394 -0
  68. package/src/constants/regex.ts +97 -0
  69. package/src/constants/{response_constants.js → response_constants.ts} +69 -62
  70. package/src/exceptions.ts +154 -0
  71. package/src/exports/aicc.js +1 -1
  72. package/src/exports/scorm-again.js +3 -3
  73. package/src/exports/scorm12.js +1 -1
  74. package/src/exports/scorm2004.js +1 -1
  75. package/src/helpers/scheduled_commit.ts +42 -0
  76. package/src/interfaces/IBaseAPI.ts +35 -0
  77. package/src/types/api_types.ts +32 -0
  78. package/src/utilities/debounce.ts +31 -0
  79. package/src/utilities.ts +338 -0
  80. package/tea.yaml +6 -0
  81. package/test/{AICC.spec.js → AICC.spec.ts} +79 -71
  82. package/test/Scorm12API.spec.ts +833 -0
  83. package/test/Scorm2004API.spec.ts +1298 -0
  84. package/test/api_helpers.ts +176 -0
  85. package/test/cmi/aicc_cmi.spec.ts +845 -0
  86. package/test/cmi/{scorm12_cmi.spec.js → scorm12_cmi.spec.ts} +253 -271
  87. package/test/cmi/scorm2004_cmi.spec.ts +1031 -0
  88. package/test/cmi_helpers.ts +207 -0
  89. package/test/exceptions.spec.ts +79 -0
  90. package/test/field_values.ts +202 -0
  91. package/test/types/api_types.spec.ts +126 -0
  92. package/test/utilities/debounce.spec.ts +56 -0
  93. package/test/utilities.spec.ts +322 -0
  94. package/tsconfig.json +18 -0
  95. package/webpack.config.js +65 -0
  96. package/.circleci/config.yml +0 -99
  97. package/.codeclimate.yml +0 -7
  98. package/.eslintrc.js +0 -36
  99. package/src/.flowconfig +0 -11
  100. package/src/AICC.js +0 -68
  101. package/src/BaseAPI.js +0 -1275
  102. package/src/Scorm12API.js +0 -308
  103. package/src/Scorm2004API.js +0 -572
  104. package/src/cmi/aicc_cmi.js +0 -1141
  105. package/src/cmi/common.js +0 -328
  106. package/src/cmi/scorm12_cmi.js +0 -1312
  107. package/src/cmi/scorm2004_cmi.js +0 -1692
  108. package/src/constants/api_constants.js +0 -218
  109. package/src/constants/error_codes.js +0 -87
  110. package/src/constants/language_constants.js +0 -76
  111. package/src/constants/regex.js +0 -84
  112. package/src/exceptions.js +0 -104
  113. package/src/utilities.js +0 -242
  114. package/test/Scorm12API.spec.js +0 -528
  115. package/test/Scorm2004API.spec.js +0 -775
  116. package/test/abstract_classes.spec.js +0 -17
  117. package/test/api_helpers.js +0 -128
  118. package/test/cmi/aicc_cmi.spec.js +0 -684
  119. package/test/cmi/scorm2004_cmi.spec.js +0 -1066
  120. package/test/cmi_helpers.js +0 -161
  121. package/test/exceptions.spec.js +0 -71
  122. package/test/field_values.js +0 -353
  123. package/test/utilities.spec.js +0 -339
  124. package/webpack.js +0 -78
@@ -1,16 +1,16 @@
1
- import {expect} from 'chai';
2
- import {describe, it} from 'mocha';
3
- import APIConstants from '../../src/constants/api_constants';
4
- import ErrorCodes from '../../src/constants/error_codes';
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
+ import { CMI } from "../../src/cmi/scorm12/cmi";
6
+ import * as h from "../cmi_helpers";
7
+ import { scorm12Values } from "../field_values";
8
+ import { CMIObjectivesObject } from "../../src/cmi/scorm12/objectives";
5
9
  import {
6
- CMI,
7
10
  CMIInteractionsCorrectResponsesObject,
8
11
  CMIInteractionsObject,
9
12
  CMIInteractionsObjectivesObject,
10
- CMIObjectivesObject,
11
- } from '../../src/cmi/scorm12_cmi';
12
- import * as h from '../cmi_helpers';
13
- import {scorm12_values} from '../field_values';
13
+ } from "../../src/cmi/scorm12/interactions";
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('SCORM 1.2 CMI Tests', () => {
50
- describe('getCurrentTotalTime()', () => {
49
+ describe("SCORM 1.2 CMI Tests", () => {
50
+ describe("getCurrentTotalTime()", () => {
51
51
  h.checkGetCurrentTotalTime({
52
52
  cmi: cmi(),
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',
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: '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',
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: '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',
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: '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',
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: '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',
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('CMI Spec Tests', () => {
94
- describe('Pre-Initialize Tests', () => {
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: 'cmi._version',
101
- expectedValue: '3.4',
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: 'cmi._children',
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: 'cmi.suspend_data',
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: 'cmi.launch_data',
118
+ fieldName: "cmi.launch_data",
119
119
  });
120
120
  h.checkFieldConstraintSize({
121
121
  cmi: cmi(),
122
- fieldName: 'cmi.comments',
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: 'cmi.comments_from_lms',
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: 'cmi.core._children',
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: 'cmi.core.student_id',
142
+ fieldName: "cmi.core.student_id",
143
143
  });
144
144
  h.checkReadAndWrite({
145
145
  cmi: cmi(),
146
- fieldName: 'cmi.core.student_name',
146
+ fieldName: "cmi.core.student_name",
147
147
  });
148
148
  h.checkFieldConstraintSize({
149
149
  cmi: cmi(),
150
- fieldName: 'cmi.core.lesson_location',
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: 'cmi.core.credit',
156
+ fieldName: "cmi.core.credit",
157
157
  });
158
158
  h.checkRead({
159
159
  cmi: cmi(),
160
- fieldName: 'cmi.core.lesson_status',
161
- expectedValue: 'not attempted',
160
+ fieldName: "cmi.core.lesson_status",
161
+ expectedValue: "not attempted",
162
162
  });
163
163
  h.checkValidValues({
164
164
  cmi: cmi(),
165
- fieldName: 'cmi.core.lesson_status',
166
- validValues: scorm12_values.validLessonStatus,
167
- invalidValues: scorm12_values.invalidLessonStatus,
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: 'cmi.core.entry',
171
+ fieldName: "cmi.core.entry",
172
172
  });
173
173
  h.checkReadAndWrite({
174
174
  cmi: cmi(),
175
- fieldName: 'cmi.core.total_time',
175
+ fieldName: "cmi.core.total_time",
176
176
  });
177
177
  h.checkReadAndWrite({
178
178
  cmi: cmi(),
179
- fieldName: 'cmi.core.lesson_mode',
180
- expectedValue: 'normal',
179
+ fieldName: "cmi.core.lesson_mode",
180
+ expectedValue: "normal",
181
181
  });
182
182
  h.checkWrite({
183
183
  cmi: cmi(),
184
- fieldName: 'cmi.core.exit',
185
- valueToTest: 'suspend',
184
+ fieldName: "cmi.core.exit",
185
+ valueToTest: "suspend",
186
186
  });
187
187
  h.checkValidValues({
188
188
  cmi: cmi(),
189
- fieldName: 'cmi.core.exit',
190
- validValues: scorm12_values.validExit,
191
- invalidValues: scorm12_values.invalidExit,
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: 'cmi.core.session_time',
196
- valueToTest: '00:00:00',
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: 'cmi.core.session_time',
202
- validValues: scorm12_values.validTimespan,
203
- invalidValues: scorm12_values.invalidTimespan,
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: 'cmi.core.score._children',
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: 'cmi.core.score.raw',
217
+ fieldName: "cmi.core.score.raw",
218
218
  });
219
219
  h.checkValidValues({
220
220
  cmi: cmi(),
221
- fieldName: 'cmi.core.score.raw',
222
- validValues: scorm12_values.validScoreRange,
223
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.core.score.min',
227
+ fieldName: "cmi.core.score.min",
228
228
  });
229
229
  h.checkValidValues({
230
230
  cmi: cmi(),
231
- fieldName: 'cmi.core.score.min',
232
- validValues: scorm12_values.validScoreRange,
233
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.core.score.max',
238
- expectedValue: '100',
237
+ fieldName: "cmi.core.score.max",
238
+ expectedValue: "100",
239
239
  });
240
240
  h.checkValidValues({
241
241
  cmi: cmi(),
242
- fieldName: 'cmi.core.score.max',
243
- validValues: scorm12_values.validScoreRange,
244
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.objectives._children',
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: 'cmi.objectives._count',
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: 'cmi.student_data._children',
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: 'cmi.student_data.mastery_score',
274
+ fieldName: "cmi.student_data.mastery_score",
275
275
  });
276
276
  h.checkReadAndWrite({
277
277
  cmi: cmi(),
278
- fieldName: 'cmi.student_data.max_time_allowed',
278
+ fieldName: "cmi.student_data.max_time_allowed",
279
279
  });
280
280
  h.checkReadAndWrite({
281
281
  cmi: cmi(),
282
- fieldName: 'cmi.student_data.time_limit_action',
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: 'cmi.student_preference._children',
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: 'cmi.student_preference.audio',
296
+ fieldName: "cmi.student_preference.audio",
297
297
  });
298
298
  h.checkValidValues({
299
299
  cmi: cmi(),
300
- fieldName: 'cmi.student_preference.audio',
301
- validValues: scorm12_values.valid0To100Range.concat([
302
- '-1',
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: 'cmi.student_preference.language',
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: 'cmi.student_preference.speed',
312
+ fieldName: "cmi.student_preference.speed",
315
313
  });
316
314
  h.checkValidValues({
317
315
  cmi: cmi(),
318
- fieldName: 'cmi.student_preference.speed',
319
- validValues: scorm12_values.validSpeedRange,
320
- invalidValues: scorm12_values.invalidSpeedRange,
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: 'cmi.student_preference.text',
322
+ fieldName: "cmi.student_preference.text",
325
323
  });
326
324
  h.checkValidValues({
327
325
  cmi: cmi(),
328
- fieldName: 'cmi.student_preference.text',
329
- validValues: scorm12_values.validIntegerScaledRange,
330
- invalidValues: scorm12_values.invalidIntegerScaledRange,
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: 'cmi.interactions._children',
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: 'cmi.interactions._count',
342
+ fieldName: "cmi.interactions._count",
345
343
  expectedValue: 0,
346
344
  expectedError: invalid_set,
347
345
  });
348
346
  });
349
347
 
350
- describe('Post-Initialize Tests', () => {
348
+ describe("Post-Initialize Tests", () => {
351
349
  /**
352
350
  * Base CMI Properties
353
351
  */
354
352
  h.checkReadOnly({
355
353
  cmi: cmiInitialized(),
356
- fieldName: 'cmi._version',
357
- expectedValue: '3.4',
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: 'cmi._children',
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: 'cmi.suspend_data',
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: 'cmi.suspend_data',
375
- valueToTest: '',
372
+ fieldName: "cmi.suspend_data",
373
+ valueToTest: "",
376
374
  });
377
375
  h.checkFieldConstraintSize({
378
376
  cmi: cmiInitialized(),
379
- fieldName: 'cmi.core.suspend_data',
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: 'cmi.core.suspend_data',
386
- valueToTest: '',
383
+ fieldName: "cmi.core.suspend_data",
384
+ valueToTest: "",
387
385
  });
388
386
  h.checkReadOnly({
389
387
  cmi: cmiInitialized(),
390
- fieldName: 'cmi.launch_data',
388
+ fieldName: "cmi.launch_data",
391
389
  expectedError: read_only,
392
390
  });
393
391
  h.checkFieldConstraintSize({
394
392
  cmi: cmiInitialized(),
395
- fieldName: 'cmi.comments',
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: 'cmi.comments_from_lms',
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: 'cmi.core._children',
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: 'cmi.core.student_id',
414
+ fieldName: "cmi.core.student_id",
417
415
  expectedError: read_only,
418
416
  });
419
417
  h.checkReadOnly({
420
418
  cmi: cmiInitialized(),
421
- fieldName: 'cmi.core.student_name',
419
+ fieldName: "cmi.core.student_name",
422
420
  expectedError: read_only,
423
421
  });
424
422
  h.checkFieldConstraintSize({
425
423
  cmi: cmiInitialized(),
426
- fieldName: 'cmi.core.lesson_location',
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: 'cmi.core.credit',
430
+ fieldName: "cmi.core.credit",
433
431
  expectedError: read_only,
434
432
  });
435
433
  h.checkRead({
436
434
  cmi: cmiInitialized(),
437
- fieldName: 'cmi.core.lesson_status',
438
- expectedValue: 'not attempted',
435
+ fieldName: "cmi.core.lesson_status",
436
+ expectedValue: "not attempted",
439
437
  });
440
438
  h.checkWrite({
441
439
  cmi: cmi(),
442
- fieldName: 'cmi.core.lesson_status',
443
- valueToTest: 'not attempted',
440
+ fieldName: "cmi.core.lesson_status",
441
+ valueToTest: "not attempted",
444
442
  });
445
443
  h.checkValidValues({
446
444
  cmi: cmi(),
447
- fieldName: 'cmi.core.lesson_status',
448
- validValues: scorm12_values.validLessonStatus.concat([
449
- 'not attempted',
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: 'cmi.core.lesson_status',
456
- validValues: scorm12_values.validLessonStatus,
457
- invalidValues: scorm12_values.invalidLessonStatus.concat([
458
- 'not attempted',
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: 'cmi.core.entry',
459
+ fieldName: "cmi.core.entry",
464
460
  expectedError: read_only,
465
461
  });
466
462
  h.checkReadOnly({
467
463
  cmi: cmiInitialized(),
468
- fieldName: 'cmi.core.total_time',
464
+ fieldName: "cmi.core.total_time",
469
465
  expectedError: read_only,
470
466
  });
471
467
  h.checkReadOnly({
472
468
  cmi: cmiInitialized(),
473
- fieldName: 'cmi.core.lesson_mode',
474
- expectedValue: 'normal',
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: 'cmi.core.exit',
480
- valueToTest: 'suspend',
475
+ fieldName: "cmi.core.exit",
476
+ valueToTest: "suspend",
481
477
  });
482
478
  h.checkValidValues({
483
479
  cmi: cmiInitialized(),
484
- fieldName: 'cmi.core.exit',
485
- validValues: scorm12_values.validExit,
486
- invalidValues: scorm12_values.invalidExit,
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: 'cmi.core.session_time',
491
- valueToTest: '00:00:00',
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: 'cmi.core.session_time',
497
- validValues: scorm12_values.validTimespan,
498
- invalidValues: scorm12_values.invalidTimespan,
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: 'cmi.core.score._children',
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: 'cmi.core.score.raw',
513
- validValues: scorm12_values.validScoreRange,
514
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.core.score.min',
519
- validValues: scorm12_values.validScoreRange,
520
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.core.score.max',
525
- validValues: scorm12_values.validScoreRange,
526
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.objectives._children',
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: 'cmi.objectives._count',
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: 'cmi.student_data._children',
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: 'cmi.student_data.mastery_score',
552
+ fieldName: "cmi.student_data.mastery_score",
557
553
  expectedError: read_only,
558
554
  });
559
555
  h.checkReadOnly({
560
556
  cmi: cmiInitialized(),
561
- fieldName: 'cmi.student_data.max_time_allowed',
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: 'cmi.student_data.time_limit_action',
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: 'cmi.student_preference._children',
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: 'cmi.student_preference.audio',
582
- validValues: scorm12_values.valid0To100Range.concat(['-1']),
583
- invalidValues: scorm12_values.invalid0To100Range,
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: 'cmi.student_preference.language',
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: 'cmi.student_preference.speed',
594
- validValues: scorm12_values.validSpeedRange,
595
- invalidValues: scorm12_values.invalidSpeedRange,
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: 'cmi.student_preference.text',
600
- validValues: scorm12_values.validIntegerScaledRange,
601
- invalidValues: scorm12_values.invalidIntegerScaledRange,
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: 'cmi.interactions._children',
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: 'cmi.interactions._count',
611
+ fieldName: "cmi.interactions._count",
616
612
  expectedValue: 0,
617
613
  expectedError: invalid_set,
618
614
  });
619
615
 
620
- it('should export JSON', () => {
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
- JSON.stringify(cmiObj),
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('CMIInteractionsObject Tests', () => {
626
+ describe("CMIInteractionsObject Tests", () => {
634
627
  /**
635
628
  * cmi.interactions.n object
636
629
  */
637
630
  h.checkWriteOnly({
638
631
  cmi: interaction(),
639
- fieldName: 'cmi.id',
632
+ fieldName: "cmi.id",
640
633
  expectedError: write_only,
641
634
  });
642
635
  h.checkWriteOnly({
643
636
  cmi: interactionInitialized(),
644
- fieldName: 'cmi.id',
637
+ fieldName: "cmi.id",
645
638
  expectedError: write_only,
646
639
  });
647
640
  h.checkWriteOnly({
648
641
  cmi: interaction(),
649
- fieldName: 'cmi.time',
642
+ fieldName: "cmi.time",
650
643
  expectedError: write_only,
651
- valueToTest: '23:59:59',
644
+ valueToTest: "23:59:59",
652
645
  });
653
646
  h.checkValidValues({
654
647
  cmi: interaction(),
655
- fieldName: 'cmi.time',
656
- validValues: scorm12_values.validTime,
657
- invalidValues: scorm12_values.invalidTime,
648
+ fieldName: "cmi.time",
649
+ validValues: scorm12Values.validTime,
650
+ invalidValues: scorm12Values.invalidTime,
658
651
  });
659
652
  h.checkWriteOnly({
660
653
  cmi: interaction(),
661
- fieldName: 'cmi.type',
654
+ fieldName: "cmi.type",
662
655
  expectedError: write_only,
663
- valueToTest: 'true-false',
656
+ valueToTest: "true-false",
664
657
  });
665
658
  h.checkValidValues({
666
659
  cmi: interaction(),
667
- fieldName: 'cmi.type',
668
- validValues: scorm12_values.validType,
669
- invalidValues: scorm12_values.invalidType,
660
+ fieldName: "cmi.type",
661
+ validValues: scorm12Values.validType,
662
+ invalidValues: scorm12Values.invalidType,
670
663
  });
671
664
  h.checkReadOnly({
672
665
  cmi: interaction(),
673
- fieldName: 'cmi.objectives._count',
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: 'cmi.correct_responses._count',
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: 'cmi.weighting',
678
+ fieldName: "cmi.weighting",
686
679
  expectedError: write_only,
687
- valueToTest: '0',
680
+ valueToTest: "0",
688
681
  });
689
682
  h.checkValidValues({
690
683
  cmi: interaction(),
691
- fieldName: 'cmi.weighting',
692
- validValues: scorm12_values.validSpeedRange,
693
- invalidValues: scorm12_values.invalidSpeedRange,
684
+ fieldName: "cmi.weighting",
685
+ validValues: scorm12Values.validSpeedRange,
686
+ invalidValues: scorm12Values.invalidSpeedRange,
694
687
  });
695
688
  h.checkWriteOnly({
696
689
  cmi: interaction(),
697
- fieldName: 'cmi.student_response',
690
+ fieldName: "cmi.student_response",
698
691
  expectedError: write_only,
699
692
  });
700
693
  h.checkWriteOnly({
701
694
  cmi: interaction(),
702
- fieldName: 'cmi.result',
695
+ fieldName: "cmi.result",
703
696
  expectedError: write_only,
704
- valueToTest: 'correct',
697
+ valueToTest: "correct",
705
698
  });
706
699
  h.checkValidValues({
707
700
  cmi: interaction(),
708
- fieldName: 'cmi.result',
709
- validValues: scorm12_values.validResult.concat([
710
- '1',
711
- '999',
712
- '999.99999',
701
+ fieldName: "cmi.result",
702
+ validValues: scorm12Values.validResult.concat([
703
+ "1",
704
+ "999",
705
+ "999.99999",
713
706
  ]),
714
- invalidValues: scorm12_values.invalidResult,
707
+ invalidValues: scorm12Values.invalidResult,
715
708
  });
716
709
  h.checkWriteOnly({
717
710
  cmi: interaction(),
718
- fieldName: 'cmi.latency',
719
- valueToTest: '00:00:00',
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: 'cmi.latency',
725
- validValues: scorm12_values.validTimespan,
726
- invalidValues: scorm12_values.invalidTimespan,
717
+ fieldName: "cmi.latency",
718
+ validValues: scorm12Values.validTimespan,
719
+ invalidValues: scorm12Values.invalidTimespan,
727
720
  });
728
721
 
729
- it('should export JSON', () => {
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
- new CMIInteractionsCorrectResponsesObject());
734
- expect(
735
- JSON.stringify(cmi),
736
- ).
737
- to.
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('CMIInteractionsObjectivesObject Tests', () => {
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: 'cmi.id',
740
+ fieldName: "cmi.id",
750
741
  });
751
742
 
752
- it('should export JSON', () => {
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('CMIInteractionsCorrectResponsesObject Tests', () => {
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: 'cmi.pattern',
755
+ fieldName: "cmi.pattern",
767
756
  expectedError: write_only,
768
757
  });
769
758
 
770
- it('should export JSON', () => {
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('CMIObjectivesObject Tests', () => {
765
+ describe("CMIObjectivesObject Tests", () => {
779
766
  /**
780
767
  * cmi.objectives.n object
781
768
  */
782
769
  h.checkReadAndWrite({
783
770
  cmi: objective(),
784
- fieldName: 'cmi.id',
771
+ fieldName: "cmi.id",
785
772
  });
786
773
  h.checkRead({
787
774
  cmi: objective(),
788
- fieldName: 'cmi.status',
775
+ fieldName: "cmi.status",
789
776
  });
790
777
  h.checkValidValues({
791
778
  cmi: objective(),
792
- fieldName: 'cmi.status',
793
- validValues: scorm12_values.validLessonStatus.concat([
794
- 'not attempted',
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: 'cmi.score._children',
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: 'cmi.score.raw',
795
+ fieldName: "cmi.score.raw",
811
796
  });
812
797
  h.checkValidValues({
813
798
  cmi: objective(),
814
- fieldName: 'cmi.score.raw',
815
- validValues: scorm12_values.validScoreRange,
816
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.score.min',
805
+ fieldName: "cmi.score.min",
821
806
  });
822
807
  h.checkValidValues({
823
808
  cmi: objective(),
824
- fieldName: 'cmi.score.min',
825
- validValues: scorm12_values.validScoreRange,
826
- invalidValues: scorm12_values.invalidScoreRange,
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: 'cmi.score.max',
831
- expectedValue: '100',
815
+ fieldName: "cmi.score.max",
816
+ expectedValue: "100",
832
817
  });
833
818
  h.checkValidValues({
834
819
  cmi: objective(),
835
- fieldName: 'cmi.score.max',
836
- validValues: scorm12_values.validScoreRange,
837
- invalidValues: scorm12_values.invalidScoreRange,
820
+ fieldName: "cmi.score.max",
821
+ validValues: scorm12Values.validScoreRange,
822
+ invalidValues: scorm12Values.invalidScoreRange,
838
823
  });
839
824
 
840
- it('should export JSON', () => {
825
+ it("should export JSON", () => {
841
826
  const cmi = objective();
842
- expect(
843
- JSON.stringify(cmi),
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
  });