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.
|
@@ -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
|
@@ -118,14 +118,13 @@ describe('loadRouteConfig()', () => {
|
|
|
118
118
|
)
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
-
it('should
|
|
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
|
|
126
|
-
|
|
127
|
-
|
|
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 () => {
|