adapt-authoring-server 2.2.1 → 2.2.3

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.
@@ -1,4 +1,4 @@
1
- name: Standard.js formatting check
1
+ name: Lint
2
2
  on: push
3
3
  jobs:
4
4
  default:
@@ -9,4 +9,4 @@ jobs:
9
9
  with:
10
10
  node-version: 'lts/*'
11
11
  - run: npm install
12
- - run: npx standard
12
+ - run: npx standard
@@ -66,8 +66,8 @@ export async function loadRouteConfig (rootDir, target, options = {}) {
66
66
  ? resolveHandlers(config.routes, target, aliases)
67
67
  : []
68
68
 
69
- // Prepend default routes from template if provided
70
- if (options.defaults) {
69
+ // Prepend default routes from template if provided (unless useDefaultRoutes is false)
70
+ if (options.defaults && config.useDefaultRoutes !== false) {
71
71
  const template = await readJson(options.defaults)
72
72
  const defaultRoutes = resolveHandlers(template.routes || [], target, aliases)
73
73
  // Apply override routes onto matching defaults
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-server",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Provides an Express application routing and more",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-server",
6
6
  "license": "GPL-3.0",
@@ -118,14 +118,13 @@ describe('loadRouteConfig()', () => {
118
118
  )
119
119
  })
120
120
 
121
- it('should throw when routes.json fails schema validation (missing required root)', async () => {
121
+ it('should accept routes.json without root property', async () => {
122
122
  const dir = path.join(tmpDir, 'no-root')
123
123
  await mkdir(dir, { recursive: true })
124
124
  await writeJson(path.join(dir, 'routes.json'), { routes: [] })
125
- await assert.rejects(
126
- () => loadRouteConfig(dir, {}),
127
- /Invalid routes\.json.*must have required property 'root'/s
128
- )
125
+ const config = await loadRouteConfig(dir, {})
126
+ assert.ok(config !== null)
127
+ assert.equal(config.root, undefined)
129
128
  })
130
129
 
131
130
  it('should throw when routes.json fails schema validation (wrong type for root)', async () => {