Comparing version 7.1.1 to 7.1.2
11
boot.js
@@ -332,7 +332,16 @@ 'use strict' | ||
/** | ||
* The `encapsulateThreeParam` let callback function | ||
* bind to the right server instance. | ||
* In promises we need to track the last server | ||
* instance loaded, the first one in the _current queue. | ||
*/ | ||
const relativeContext = this._current[0].server | ||
function readyPromiseCB (err, context, done) { | ||
// the context is always binded to the root server | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(context) | ||
resolve(relativeContext) | ||
} | ||
@@ -339,0 +348,0 @@ process.nextTick(done) |
{ | ||
"name": "avvio", | ||
"version": "7.1.1", | ||
"version": "7.1.2", | ||
"description": "Asynchronous bootstrapping of Node applications", | ||
@@ -5,0 +5,0 @@ "main": "boot.js", |
@@ -199,2 +199,53 @@ 'use strict' | ||
test('if the after/ready async, the returns must be the context generated', (t) => { | ||
t.plan(3) | ||
const server = { my: 'server', index: 0 } | ||
const app = boot(server) | ||
app.override = function (old) { | ||
return { ...old, index: old.index + 1 } | ||
} | ||
app.use(function (s, opts, done) { | ||
s.use(function (s, opts, done) { | ||
s.ready().then(itself => t.deepEqual(itself, s, 'deep deep')) | ||
done() | ||
}) | ||
s.ready().then(itself => t.deepEqual(itself, s, 'deep')) | ||
done() | ||
}) | ||
app.ready().then(itself => t.deepEqual(itself, server, 'outer')) | ||
}) | ||
test('if the after/ready callback, the returns must be the context generated', (t) => { | ||
t.plan(3) | ||
const server = { my: 'server', index: 0 } | ||
const app = boot(server) | ||
app.override = function (old) { | ||
return { ...old, index: old.index + 1 } | ||
} | ||
app.use(function (s, opts, done) { | ||
s.use(function (s, opts, done) { | ||
s.ready((_, itself, done) => { | ||
t.deepEqual(itself, s, 'deep deep') | ||
done() | ||
}) | ||
done() | ||
}) | ||
s.ready((_, itself, done) => { | ||
t.deepEqual(itself, s, 'deep') | ||
done() | ||
}) | ||
done() | ||
}) | ||
app.ready((_, itself, done) => { | ||
t.deepEqual(itself, server, 'outer') | ||
done() | ||
}) | ||
}) | ||
test('error should come in the first after - one parameter', (t) => { | ||
@@ -201,0 +252,0 @@ t.plan(3) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134280
4565