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.
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Update npm
26
26
  run: npm install -g npm@latest
27
27
  - name: Install dependencies
28
- run: npm ci
28
+ run: npm install
29
29
  - name: Release
30
30
  env:
31
31
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -9,5 +9,5 @@ jobs:
9
9
  with:
10
10
  node-version: 'lts/*'
11
11
  cache: 'npm'
12
- - run: npm ci
12
+ - run: npm install
13
13
  - run: npx standard
@@ -11,5 +11,5 @@ jobs:
11
11
  with:
12
12
  node-version: 'lts/*'
13
13
  cache: 'npm'
14
- - run: npm ci
14
+ - run: npm install
15
15
  - run: npm test
@@ -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.0",
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": "^1.7.0"
14
+ "adapt-authoring-core": "^2.0.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "adapt-authoring-auth": "^1.0.7",
18
- "adapt-authoring-content": "^1.2.3",
19
- "adapt-authoring-server": "^1.2.1"
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 assert.rejects(
138
- () => instance.insertTrackingId(data),
139
- TypeError
140
- )
133
+ await instance.insertTrackingId(data)
134
+ assert.equal(data._trackingId, 1)
141
135
  })
142
136
  })
143
137