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
@@ -0,0 +1,322 @@
1
+ import { expect } from "expect";
2
+ import { describe, it } from "mocha";
3
+ import * as Utilities from "../src/utilities";
4
+ import Regex from "../src/constants/regex";
5
+
6
+ const scorm12_regex = Regex.scorm12;
7
+ const scorm2004_regex = Regex.scorm2004;
8
+
9
+ describe("Utility Tests", () => {
10
+ describe("getSecondsAsHHMMSS()", () => {
11
+ it("10 returns 00:00:10", () => {
12
+ expect(Utilities.getSecondsAsHHMMSS(10)).toEqual("00:00:10");
13
+ });
14
+
15
+ it("60 returns 00:01:00", () => {
16
+ expect(Utilities.getSecondsAsHHMMSS(60)).toEqual("00:01:00");
17
+ });
18
+
19
+ it("3600 returns 01:00:00", () => {
20
+ expect(Utilities.getSecondsAsHHMMSS(3600)).toEqual("01:00:00");
21
+ });
22
+
23
+ it("70 returns 00:01:10", () => {
24
+ expect(Utilities.getSecondsAsHHMMSS(70)).toEqual("00:01:10");
25
+ });
26
+
27
+ it("3670 returns 01:01:10", () => {
28
+ expect(Utilities.getSecondsAsHHMMSS(3670)).toEqual("01:01:10");
29
+ });
30
+
31
+ it("90000 returns 25:00:00, check for hours greater than 24", () => {
32
+ expect(Utilities.getSecondsAsHHMMSS(90000)).toEqual("25:00:00");
33
+ });
34
+
35
+ it("-3600 returns 00:00:00, negative time not allowed in SCORM session times", () => {
36
+ expect(Utilities.getSecondsAsHHMMSS(-3600)).toEqual("00:00:00");
37
+ });
38
+
39
+ it("Empty seconds returns 00:00:00", () => {
40
+ expect(Utilities.getSecondsAsHHMMSS(null)).toEqual("00:00:00");
41
+ });
42
+ });
43
+
44
+ describe("getSecondsAsISODuration()", () => {
45
+ it("10 returns PT10S", () => {
46
+ expect(Utilities.getSecondsAsISODuration(10)).toEqual("PT10S");
47
+ });
48
+
49
+ it("60 returns PT1M", () => {
50
+ expect(Utilities.getSecondsAsISODuration(60)).toEqual("PT1M");
51
+ });
52
+
53
+ it("3600 returns PT1H", () => {
54
+ expect(Utilities.getSecondsAsISODuration(3600)).toEqual("PT1H");
55
+ });
56
+
57
+ it("70 returns PT1M10S", () => {
58
+ expect(Utilities.getSecondsAsISODuration(70)).toEqual("PT1M10S");
59
+ });
60
+
61
+ it("916.88 returns PT15M16.88S", () => {
62
+ expect(Utilities.getSecondsAsISODuration(916.88)).toEqual("PT15M16.88S");
63
+ });
64
+
65
+ it("3670 returns PT1H1M10S", () => {
66
+ expect(Utilities.getSecondsAsISODuration(3670)).toEqual("PT1H1M10S");
67
+ });
68
+
69
+ it("90000 returns P1DT1H", () => {
70
+ expect(Utilities.getSecondsAsISODuration(90000)).toEqual("P1DT1H");
71
+ });
72
+
73
+ it("90061 returns P1DT1H1M1S", () => {
74
+ expect(Utilities.getSecondsAsISODuration(90061)).toEqual("P1DT1H1M1S");
75
+ });
76
+
77
+ it("-3600 returns PT0S, negative time not allowed in SCORM session times", () => {
78
+ expect(Utilities.getSecondsAsISODuration(-3600)).toEqual("PT0S");
79
+ });
80
+
81
+ it("Empty seconds returns PT0S", () => {
82
+ expect(Utilities.getSecondsAsISODuration(null)).toEqual("PT0S");
83
+ });
84
+ });
85
+
86
+ describe("getTimeAsSeconds()", () => {
87
+ it("00:00:10 returns 10", () => {
88
+ expect(
89
+ Utilities.getTimeAsSeconds("00:00:10", scorm12_regex.CMITimespan),
90
+ ).toEqual(10);
91
+ });
92
+
93
+ it("00:01:10 returns 70", () => {
94
+ expect(
95
+ Utilities.getTimeAsSeconds("00:01:10", scorm12_regex.CMITimespan),
96
+ ).toEqual(70);
97
+ });
98
+
99
+ it("01:01:10 returns 3670", () => {
100
+ expect(
101
+ Utilities.getTimeAsSeconds("01:01:10", scorm12_regex.CMITimespan),
102
+ ).toEqual(3670);
103
+ });
104
+
105
+ it("100:00:00 returns 3670", () => {
106
+ expect(
107
+ Utilities.getTimeAsSeconds("100:00:00", scorm12_regex.CMITimespan),
108
+ ).toEqual(360000);
109
+ });
110
+
111
+ it("-01:00:00 returns 0", () => {
112
+ expect(
113
+ Utilities.getTimeAsSeconds("-01:00:00", scorm12_regex.CMITimespan),
114
+ ).toEqual(0);
115
+ });
116
+
117
+ it("Number value returns 0", () => {
118
+ expect(
119
+ Utilities.getTimeAsSeconds(999, scorm12_regex.CMITimespan),
120
+ ).toEqual(0);
121
+ });
122
+
123
+ it("boolean value returns 0", () => {
124
+ expect(
125
+ Utilities.getTimeAsSeconds(true, scorm12_regex.CMITimespan),
126
+ ).toEqual(0);
127
+ });
128
+
129
+ it("Empty value returns 0", () => {
130
+ expect(
131
+ Utilities.getTimeAsSeconds(null, scorm12_regex.CMITimespan),
132
+ ).toEqual(0);
133
+ });
134
+ });
135
+
136
+ describe("getDurationAsSeconds()", () => {
137
+ it("P0S returns 0", () => {
138
+ expect(
139
+ Utilities.getDurationAsSeconds("P0S", scorm2004_regex.CMITimespan),
140
+ ).toEqual(0);
141
+ });
142
+
143
+ it("P70S returns 70", () => {
144
+ expect(
145
+ Utilities.getDurationAsSeconds("P70S", scorm2004_regex.CMITimespan),
146
+ ).toEqual(70);
147
+ });
148
+
149
+ it("PT1M10S returns 70", () => {
150
+ expect(
151
+ Utilities.getDurationAsSeconds("PT1M10S", scorm2004_regex.CMITimespan),
152
+ ).toEqual(70);
153
+ });
154
+
155
+ it("PT15M16.88S returns 916.88", () => {
156
+ expect(
157
+ Utilities.getDurationAsSeconds(
158
+ "PT15M16.88S",
159
+ scorm2004_regex.CMITimespan,
160
+ ),
161
+ ).toEqual(916.88);
162
+ });
163
+
164
+ it("P1D returns 86400", () => {
165
+ expect(
166
+ Utilities.getDurationAsSeconds("P1D", scorm2004_regex.CMITimespan),
167
+ ).toEqual(24 * 60 * 60);
168
+ });
169
+
170
+ it("P1Y returns number of seconds for one year from now", () => {
171
+ expect(
172
+ Utilities.getDurationAsSeconds("P1Y", scorm2004_regex.CMITimespan),
173
+ ).toEqual(365 * 24 * 60 * 60);
174
+ });
175
+
176
+ it("Invalid duration returns 0", () => {
177
+ expect(
178
+ Utilities.getDurationAsSeconds("T1M10S", scorm2004_regex.CMITimespan),
179
+ ).toEqual(0);
180
+ });
181
+
182
+ it("Empty duration returns 0", () => {
183
+ expect(
184
+ Utilities.getDurationAsSeconds(null, scorm2004_regex.CMITimespan),
185
+ ).toEqual(0);
186
+ });
187
+ });
188
+
189
+ describe("addTwoDurations()", () => {
190
+ it("P1H5M30.5S plus PT15M10S equals P1H20M40.5S", () => {
191
+ expect(
192
+ Utilities.addTwoDurations(
193
+ "PT1H5M30.5S",
194
+ "PT15M30S",
195
+ scorm2004_regex.CMITimespan,
196
+ ),
197
+ ).toEqual("PT1H21M0.5S");
198
+ });
199
+ it("P1Y364D plus P2DT1H45M52S equals P731DT1H45M52S", () => {
200
+ expect(
201
+ Utilities.addTwoDurations(
202
+ "P1Y364D",
203
+ "P2DT1H45M52S",
204
+ scorm2004_regex.CMITimespan,
205
+ ),
206
+ ).toEqual("P731DT1H45M52S");
207
+ });
208
+ it("Invalid plus valid equals valid", () => {
209
+ expect(
210
+ Utilities.addTwoDurations(
211
+ "NOT A VALID DURATION",
212
+ "PT1H30M45S",
213
+ scorm2004_regex.CMITimespan,
214
+ ),
215
+ ).toEqual("PT1H30M45S");
216
+ });
217
+ it("Valid plus invalid equals valid", () => {
218
+ expect(
219
+ Utilities.addTwoDurations(
220
+ "PT1H30M45S",
221
+ "NOT A VALID DURATION",
222
+ scorm2004_regex.CMITimespan,
223
+ ),
224
+ ).toEqual("PT1H30M45S");
225
+ });
226
+ });
227
+
228
+ describe("addHHMMSSTimeStrings()", () => {
229
+ it("01:05:30.5 plus 00:15:10 equals 01:20:40.5", () => {
230
+ expect(
231
+ Utilities.addHHMMSSTimeStrings(
232
+ "01:05:30.5",
233
+ "00:15:30",
234
+ scorm12_regex.CMITimespan,
235
+ ),
236
+ ).toEqual("01:21:00.5");
237
+ });
238
+ it("17496:00:00 plus 49:35:52 equals 17545:35:52", () => {
239
+ expect(
240
+ Utilities.addHHMMSSTimeStrings(
241
+ "17496:00:00",
242
+ "49:35:52",
243
+ scorm12_regex.CMITimespan,
244
+ ),
245
+ ).toEqual("17545:35:52");
246
+ });
247
+ it("Invalid plus valid equals valid", () => {
248
+ expect(
249
+ Utilities.addHHMMSSTimeStrings(
250
+ "-00:15:10",
251
+ "01:05:30.5",
252
+ scorm12_regex.CMITimespan,
253
+ ),
254
+ ).toEqual("01:05:30.5");
255
+ });
256
+ it("Valid plus invalid equals valid", () => {
257
+ expect(
258
+ Utilities.addHHMMSSTimeStrings(
259
+ "01:05:30.5",
260
+ "NOT A VALID DURATION",
261
+ scorm12_regex.CMITimespan,
262
+ ),
263
+ ).toEqual("01:05:30.5");
264
+ });
265
+ });
266
+
267
+ describe("flatten()", () => {
268
+ it("Should return flattened object", () => {
269
+ expect(
270
+ Utilities.flatten({
271
+ cmi: {
272
+ core: {
273
+ learner_id: "jputney",
274
+ learner_name: "Jonathan",
275
+ },
276
+ objectives: {
277
+ "0": {
278
+ id: "AAA",
279
+ },
280
+ "1": {
281
+ id: "BBB",
282
+ },
283
+ },
284
+ },
285
+ }),
286
+ ).toEqual({
287
+ "cmi.core.learner_id": "jputney",
288
+ "cmi.core.learner_name": "Jonathan",
289
+ "cmi.objectives.0.id": "AAA",
290
+ "cmi.objectives.1.id": "BBB",
291
+ });
292
+ });
293
+ });
294
+
295
+ describe("unflatten()", () => {
296
+ it("Should return flattened object", () => {
297
+ expect(
298
+ Utilities.unflatten({
299
+ "cmi.core.learner_id": "jputney",
300
+ "cmi.core.learner_name": "Jonathan",
301
+ "cmi.objectives.0.id": "AAA",
302
+ "cmi.objectives.1.id": "BBB",
303
+ }),
304
+ ).toEqual({
305
+ cmi: {
306
+ core: {
307
+ learner_id: "jputney",
308
+ learner_name: "Jonathan",
309
+ },
310
+ objectives: {
311
+ "0": {
312
+ id: "AAA",
313
+ },
314
+ "1": {
315
+ id: "BBB",
316
+ },
317
+ },
318
+ },
319
+ });
320
+ });
321
+ });
322
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "sourceMap": true,
4
+ "noImplicitAny": true,
5
+ "declaration": false,
6
+ "module": "es2015",
7
+ "moduleResolution": "Node",
8
+ "target": "es5",
9
+ "emitDecoratorMetadata": true,
10
+ "experimentalDecorators": true,
11
+ "typeRoots": ["node_modules/@types"],
12
+ "removeComments": true,
13
+ "importHelpers": true,
14
+ "forceConsistentCasingInFileNames": true
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules"]
18
+ }
@@ -0,0 +1,65 @@
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ import ESLintPlugin from "eslint-webpack-plugin";
4
+ import TerserPlugin from "terser-webpack-plugin";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ const TSLoader = {
10
+ test: /\.ts$/i,
11
+ exclude: /node_modules/,
12
+ use: {
13
+ loader: "ts-loader",
14
+ },
15
+ };
16
+
17
+ export default {
18
+ mode: "production",
19
+ devtool: "source-map",
20
+ entry: {
21
+ aicc: "./src/exports/aicc.js",
22
+ scorm12: "./src/exports/scorm12.js",
23
+ scorm2004: "./src/exports/scorm2004.js",
24
+ "scorm-again": "./src/exports/scorm-again.js",
25
+ "aicc.min": "./src/exports/aicc.js",
26
+ "scorm12.min": "./src/exports/scorm12.js",
27
+ "scorm2004.min": "./src/exports/scorm2004.js",
28
+ "scorm-again.min": "./src/exports/scorm-again.js",
29
+ },
30
+ target: ["web", "es5"],
31
+ module: {
32
+ rules: [TSLoader],
33
+ },
34
+ output: {
35
+ path: path.resolve(__dirname, "dist"),
36
+ environment: {
37
+ arrowFunction: false,
38
+ },
39
+ },
40
+ optimization: {
41
+ minimize: true,
42
+ minimizer: [
43
+ new TerserPlugin({
44
+ parallel: true,
45
+ include: /\.min\.js$/,
46
+ terserOptions: {
47
+ output: {
48
+ comments: false,
49
+ },
50
+ },
51
+ }),
52
+ ],
53
+ },
54
+ resolve: {
55
+ extensions: [".ts", ".js"],
56
+ },
57
+ plugins: [
58
+ new ESLintPlugin({
59
+ overrideConfigFile: path.resolve(__dirname, "eslint.config.js"),
60
+ configType: "flat",
61
+ context: path.resolve(__dirname, "../src"),
62
+ files: ["**/*.js", "**/*.ts"],
63
+ }),
64
+ ],
65
+ };
@@ -1,99 +0,0 @@
1
- # Javascript Node CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-javascript/ for more details
4
- #
5
- version: 2
6
- jobs:
7
- build:
8
- docker:
9
- # specify the version you desire here
10
- - image: circleci/node:lts-browsers
11
-
12
- # Specify service dependencies here if necessary
13
- # CircleCI maintains a library of pre-built images
14
- # documented at https://circleci.com/docs/2.0/circleci-images/
15
- # - image: circleci/mongo:3.4.4
16
-
17
- working_directory: ~/scorm-again
18
-
19
- steps:
20
- - checkout
21
-
22
- # Download and cache dependencies
23
- - restore_cache:
24
- keys:
25
- - v1-dependencies-{{ checksum "package.json" }}
26
- # fallback to using the latest cache if no exact match is found
27
- - v1-dependencies-
28
-
29
- - run: yarn install
30
-
31
- - save_cache:
32
- paths:
33
- - node_modules
34
- key: v1-dependencies-{{ checksum "package.json" }}
35
-
36
- - run: mkdir reports dist docs test-results || true
37
-
38
- # Run mocha
39
- - run:
40
- name: yarn test
41
- command: ./node_modules/.bin/nyc ./node_modules/.bin/mocha --require @babel/register --recursive --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=test-results/mocha/results.xml
42
- when: always
43
-
44
- # Run eslint
45
- - run:
46
- name: eslint
47
- command: |
48
- ./node_modules/.bin/eslint ./src --format junit --output-file ./reports/eslint/eslint.xml
49
- when: always
50
-
51
- # Run coverage report for Code Climate
52
- - run:
53
- name: Setup Code Climate test-reporter
54
- command: |
55
- # download test reporter as a static binary
56
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
57
- chmod +x ./cc-test-reporter
58
- ./cc-test-reporter before-build
59
- when: always
60
-
61
- - run:
62
- name: code-coverage
63
- command: |
64
- mkdir coverage
65
- # nyc report requires that nyc has already been run,
66
- # which creates the .nyc_output folder containing necessary data
67
- ./node_modules/.bin/nyc report --reporter=text-lcov > coverage/lcov.info
68
- ./cc-test-reporter after-build -t lcov
69
- when: always
70
-
71
- # compile documentation
72
- - run: ./node_modules/.bin/jsdoc -c .jsdoc.json -d ./docs ./src/
73
-
74
- # run babel compile
75
- - run: git config user.email "jputney@noverant.com" && git config user.name "Jonathan Putney"
76
- - run: ./node_modules/.bin/webpack --bail --config webpack.js
77
- - run: git add --all dist/
78
-
79
- # run jsdoc
80
- # - run: ./node_modules/.bin/jsdoc -c .jsdoc.json -d ./docs ./src/
81
- # - run: git add --all docs/
82
-
83
- # git commit and push dist and docs
84
- - run: git commit -m "[skip ci] - Updating Dist and Docs" && git push origin master || true
85
-
86
- # Upload results
87
-
88
- - store_test_results:
89
- path: test-results
90
-
91
- - store_artifacts:
92
- path: ./reports/mocha/test-results.xml
93
-
94
- - store_artifacts:
95
- path: ./reports/eslint/eslint.xml
96
-
97
- - store_artifacts: # upload test coverage as artifact
98
- path: ./coverage/lcov.info
99
- prefix: tests
package/.codeclimate.yml DELETED
@@ -1,7 +0,0 @@
1
- plugins:
2
- eslint:
3
- enabled: true
4
- config:
5
- config: .eslintrc.js
6
- markdownlint:
7
- enabled: false
package/.eslintrc.js DELETED
@@ -1,36 +0,0 @@
1
- module.exports = {
2
- parser: 'babel-eslint',
3
- env: {
4
- browser: true,
5
- es6: true,
6
- },
7
- extends: ['eslint:recommended', 'google'],
8
- globals: {
9
- Atomics: 'readonly',
10
- SharedArrayBuffer: 'readonly',
11
- },
12
- parserOptions: {
13
- sourceType: 'module',
14
- allowImportExportEverywhere: false,
15
- classPrivateMethods: true,
16
- ecmaFeatures: {
17
- globalReturn: false,
18
- },
19
- babelOptions: {
20
- configFile: './.babelrc',
21
- },
22
- },
23
- rules: {
24
- 'camelcase': 'off',
25
- 'max-len': 'off',
26
- 'no-unused-vars': 'off',
27
- },
28
- overrides: [
29
- {
30
- 'files': ['*.spec.js'],
31
- 'rules': {
32
- 'no-undef': 0,
33
- },
34
- },
35
- ],
36
- };
package/src/.flowconfig DELETED
@@ -1,11 +0,0 @@
1
- [ignore]
2
-
3
- [include]
4
-
5
- [libs]
6
-
7
- [lints]
8
-
9
- [options]
10
-
11
- [strict]
package/src/AICC.js DELETED
@@ -1,68 +0,0 @@
1
- // @flow
2
- import Scorm12API from './Scorm12API';
3
- import {
4
- CMI,
5
- CMIAttemptRecordsObject,
6
- CMIEvaluationCommentsObject,
7
- CMITriesObject,
8
- } from './cmi/aicc_cmi';
9
- import {NAV} from './cmi/scorm12_cmi';
10
-
11
- /**
12
- * The AICC API class
13
- */
14
- export default class AICC extends Scorm12API {
15
- /**
16
- * Constructor to create AICC API object
17
- * @param {object} settings
18
- */
19
- constructor(settings: {}) {
20
- const finalSettings = {
21
- ...{
22
- mastery_override: false,
23
- }, ...settings,
24
- };
25
-
26
- super(finalSettings);
27
-
28
- this.cmi = new CMI();
29
- this.nav = new NAV();
30
- }
31
-
32
- /**
33
- * Gets or builds a new child element to add to the array.
34
- *
35
- * @param {string} CMIElement
36
- * @param {any} value
37
- * @param {boolean} foundFirstIndex
38
- * @return {object}
39
- */
40
- getChildElement(CMIElement, value, foundFirstIndex) {
41
- let newChild = super.getChildElement(CMIElement, value, foundFirstIndex);
42
-
43
- if (!newChild) {
44
- if (this.stringMatches(CMIElement, 'cmi\\.evaluation\\.comments\\.\\d+')) {
45
- newChild = new CMIEvaluationCommentsObject();
46
- } else if (this.stringMatches(CMIElement,
47
- 'cmi\\.student_data\\.tries\\.\\d+')) {
48
- newChild = new CMITriesObject();
49
- } else if (this.stringMatches(CMIElement,
50
- 'cmi\\.student_data\\.attempt_records\\.\\d+')) {
51
- newChild = new CMIAttemptRecordsObject();
52
- }
53
- }
54
-
55
- return newChild;
56
- }
57
-
58
- /**
59
- * Replace the whole API with another
60
- *
61
- * @param {AICC} newAPI
62
- */
63
- replaceWithAnotherScormAPI(newAPI) {
64
- // Data Model
65
- this.cmi = newAPI.cmi;
66
- this.nav = newAPI.nav;
67
- }
68
- }