aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/retry/test/integration/test-retry-wrap.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-04-20 18:26:37 -0700
committerRebecca Turner <me@re-becca.org>2018-05-24 23:24:45 -0700
commit468ab4519e1b92473acefb22801497a1af6aebae (patch)
treebdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/retry/test/integration/test-retry-wrap.js
parentac8226115e2192a7a46ba07789fa5136f74223e1 (diff)
downloadandroid-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/retry/test/integration/test-retry-wrap.js')
-rw-r--r--deps/npm/node_modules/retry/test/integration/test-retry-wrap.js48
1 files changed, 36 insertions, 12 deletions
diff --git a/deps/npm/node_modules/retry/test/integration/test-retry-wrap.js b/deps/npm/node_modules/retry/test/integration/test-retry-wrap.js
index 7ca8bc7eb5..3d2b6bfa64 100644
--- a/deps/npm/node_modules/retry/test/integration/test-retry-wrap.js
+++ b/deps/npm/node_modules/retry/test/integration/test-retry-wrap.js
@@ -14,17 +14,17 @@ function getLib() {
(function wrapAll() {
var lib = getLib();
retry.wrap(lib);
- assert.equal(lib.fn1.name, 'retryWrapper');
- assert.equal(lib.fn2.name, 'retryWrapper');
- assert.equal(lib.fn3.name, 'retryWrapper');
+ assert.equal(lib.fn1.name, 'bound retryWrapper');
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
}());
(function wrapAllPassOptions() {
var lib = getLib();
retry.wrap(lib, {retries: 2});
- assert.equal(lib.fn1.name, 'retryWrapper');
- assert.equal(lib.fn2.name, 'retryWrapper');
- assert.equal(lib.fn3.name, 'retryWrapper');
+ assert.equal(lib.fn1.name, 'bound retryWrapper');
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
assert.equal(lib.fn1.options.retries, 2);
assert.equal(lib.fn2.options.retries, 2);
assert.equal(lib.fn3.options.retries, 2);
@@ -33,17 +33,17 @@ function getLib() {
(function wrapDefined() {
var lib = getLib();
retry.wrap(lib, ['fn2', 'fn3']);
- assert.notEqual(lib.fn1.name, 'retryWrapper');
- assert.equal(lib.fn2.name, 'retryWrapper');
- assert.equal(lib.fn3.name, 'retryWrapper');
+ assert.notEqual(lib.fn1.name, 'bound retryWrapper');
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
}());
(function wrapDefinedAndPassOptions() {
var lib = getLib();
retry.wrap(lib, {retries: 2}, ['fn2', 'fn3']);
- assert.notEqual(lib.fn1.name, 'retryWrapper');
- assert.equal(lib.fn2.name, 'retryWrapper');
- assert.equal(lib.fn3.name, 'retryWrapper');
+ assert.notEqual(lib.fn1.name, 'bound retryWrapper');
+ assert.equal(lib.fn2.name, 'bound retryWrapper');
+ assert.equal(lib.fn3.name, 'bound retryWrapper');
assert.equal(lib.fn2.options.retries, 2);
assert.equal(lib.fn3.options.retries, 2);
}());
@@ -63,6 +63,30 @@ function getLib() {
assert.ok(callbackCalled);
}());
+(function runWrappedSeveralWithoutError() {
+ var callbacksCalled = 0;
+ var lib = {
+ fn1: function (a, callback) {
+ assert.equal(a, 1);
+ assert.equal(typeof callback, 'function');
+ callback();
+ },
+ fn2: function (a, callback) {
+ assert.equal(a, 2);
+ assert.equal(typeof callback, 'function');
+ callback();
+ }
+ };
+ retry.wrap(lib, {}, ['fn1', 'fn2']);
+ lib.fn1(1, function() {
+ callbacksCalled++;
+ });
+ lib.fn2(2, function() {
+ callbacksCalled++;
+ });
+ assert.equal(callbacksCalled, 2);
+}());
+
(function runWrappedWithError() {
var callbackCalled;
var lib = {method: function(callback) {