adapt-authoring-spoortracking 1.1.0 → 1.1.2
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.
|
@@ -34,7 +34,7 @@ class SpoorTrackingModule extends AbstractModule {
|
|
|
34
34
|
return
|
|
35
35
|
}
|
|
36
36
|
const content = await this.app.waitForModule('content')
|
|
37
|
-
const [{ _trackingId }] = await content.find({ _courseId: data._courseId }, {}, { limit: 1, sort: [['_trackingId', -1]] })
|
|
37
|
+
const [{ _trackingId } = {}] = await content.find({ _courseId: data._courseId }, {}, { limit: 1, sort: [['_trackingId', -1]] })
|
|
38
38
|
data._trackingId = (_trackingId ?? 0) + 1
|
|
39
39
|
}
|
|
40
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapt-authoring-spoortracking",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Module for making course content compatible with spoor",
|
|
5
5
|
"homepage": "https://github.com/adapt-security/adapt-authoring-spoortracking",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"test": "node --test 'tests/**/*.spec.js'"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"adapt-authoring-core": "^
|
|
14
|
+
"adapt-authoring-core": "^2.0.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"adapt-authoring-auth": "^1.0.7",
|
|
18
|
-
"adapt-authoring-content": "^
|
|
19
|
-
"adapt-authoring-server": "^
|
|
18
|
+
"adapt-authoring-content": "^2.0.0",
|
|
19
|
+
"adapt-authoring-server": "^2.0.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"adapt-authoring-auth": {
|
|
@@ -127,17 +127,11 @@ describe('SpoorTrackingModule', () => {
|
|
|
127
127
|
assert.equal(data._trackingId, 1)
|
|
128
128
|
})
|
|
129
129
|
|
|
130
|
-
// TODO: BUG - insertTrackingId crashes when content.find returns an empty array
|
|
131
|
-
// Destructuring `[{ _trackingId }]` from an empty array gives `undefined`,
|
|
132
|
-
// causing a TypeError. This happens when a block is the first content item
|
|
133
|
-
// inserted for a course.
|
|
134
130
|
it('should handle empty find result gracefully', async () => {
|
|
135
131
|
instance._contentMock.find.mock.mockImplementation(async () => [])
|
|
136
132
|
const data = { _type: 'block', _courseId: 'emptyCourse' }
|
|
137
|
-
await
|
|
138
|
-
|
|
139
|
-
TypeError
|
|
140
|
-
)
|
|
133
|
+
await instance.insertTrackingId(data)
|
|
134
|
+
assert.equal(data._trackingId, 1)
|
|
141
135
|
})
|
|
142
136
|
})
|
|
143
137
|
|