[Pkg-javascript-commits] [node-retry] 07/09: Patch away fake-based tests

Paolo Greppi paolog-guest at moszumanska.debian.org
Wed Dec 14 18:53:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

paolog-guest pushed a commit to branch master
in repository node-retry.

commit bd067969df359e4473c0f546a732e04b47c66a32
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Wed Dec 14 18:37:56 2016 +0000

    Patch away fake-based tests
---
 debian/patches/00-fake.diff | 164 ++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series       |   1 +
 2 files changed, 165 insertions(+)

diff --git a/debian/patches/00-fake.diff b/debian/patches/00-fake.diff
new file mode 100644
index 0000000..52b4485
--- /dev/null
+++ b/debian/patches/00-fake.diff
@@ -0,0 +1,164 @@
+Description: Patch away fake-based tests since we don't have this
+ module in Debian yet.
+Forwarded: not-needed
+Author: Paolo Greppi <paolo.greppi at libpf.com>
+
+Index: node-retry/test/common.js
+===================================================================
+--- node-retry.orig/test/common.js
++++ node-retry/test/common.js
+@@ -7,4 +7,3 @@ common.dir = {
+ };
+ 
+ common.assert = require('assert');
+-common.fake = require('fake');
+\ No newline at end of file
+Index: node-retry/test/integration/test-retry-operation.js
+===================================================================
+--- node-retry.orig/test/integration/test-retry-operation.js
++++ node-retry/test/integration/test-retry-operation.js
+@@ -1,6 +1,5 @@
+ var common = require('../common');
+ var assert = common.assert;
+-var fake = common.fake.create();
+ var retry = require(common.dir.lib + '/retry');
+ 
+ (function testErrors() {
+@@ -51,126 +50,3 @@ var retry = require(common.dir.lib + '/r
+   assert.strictEqual(timeoutOpts.timeout, operation._operationTimeout);
+   assert.strictEqual(timeoutOpts.cb, operation._operationTimeoutCb);
+ })();
+-
+-(function testRetry() {
+-  var times = 3;
+-  var error = new Error('some error');
+-  var operation = retry.operation([1, 2, 3]);
+-  var attempts = 0;
+-
+-  var finalCallback = fake.callback('finalCallback');
+-  fake.expectAnytime(finalCallback);
+-
+-  var fn = function() {
+-    operation.attempt(function(currentAttempt) {
+-      attempts++;
+-      assert.equal(currentAttempt, attempts);
+-      if (operation.retry(error)) {
+-        return;
+-      }
+-
+-      assert.strictEqual(attempts, 4);
+-      assert.strictEqual(operation.attempts(), attempts);
+-      assert.strictEqual(operation.mainError(), error);
+-      finalCallback();
+-    });
+-  };
+-
+-  fn();
+-})();
+-
+-(function testRetryForever() {
+-  var error = new Error('some error');
+-  var operation = retry.operation({ retries: 3, forever: true });
+-  var attempts = 0;
+-
+-  var finalCallback = fake.callback('finalCallback');
+-  fake.expectAnytime(finalCallback);
+-
+-  var fn = function() {
+-    operation.attempt(function(currentAttempt) {
+-      attempts++;
+-      assert.equal(currentAttempt, attempts);
+-      if (attempts !== 6 && operation.retry(error)) {
+-        return;
+-      }
+-
+-      assert.strictEqual(attempts, 6);
+-      assert.strictEqual(operation.attempts(), attempts);
+-      assert.strictEqual(operation.mainError(), error);
+-      finalCallback();
+-    });
+-  };
+-
+-  fn();
+-})();
+-
+-(function testRetryForeverNoRetries() {
+-  var error = new Error('some error');
+-  var delay = 50
+-  var operation = retry.operation({
+-    retries: null,
+-    forever: true,
+-    minTimeout: delay,
+-    maxTimeout: delay
+-  });
+-
+-  var attempts = 0;
+-  var startTime = new Date().getTime();
+-
+-  var finalCallback = fake.callback('finalCallback');
+-  fake.expectAnytime(finalCallback);
+-
+-  var fn = function() {
+-    operation.attempt(function(currentAttempt) {
+-      attempts++;
+-      assert.equal(currentAttempt, attempts);
+-      if (attempts !== 4 && operation.retry(error)) {
+-        return;
+-      }
+-
+-      var endTime = new Date().getTime();
+-      var minTime = startTime + (delay * 3);
+-      var maxTime = minTime + 20 // add a little headroom for code execution time
+-      assert(endTime > minTime)
+-      assert(endTime < maxTime)
+-      assert.strictEqual(attempts, 4);
+-      assert.strictEqual(operation.attempts(), attempts);
+-      assert.strictEqual(operation.mainError(), error);
+-      finalCallback();
+-    });
+-  };
+-
+-  fn();
+-})();
+-
+-(function testStop() {
+-  var error = new Error('some error');
+-  var operation = retry.operation([1, 2, 3]);
+-  var attempts = 0;
+-
+-  var finalCallback = fake.callback('finalCallback');
+-  fake.expectAnytime(finalCallback);
+-
+-  var fn = function() {
+-    operation.attempt(function(currentAttempt) {
+-      attempts++;
+-      assert.equal(currentAttempt, attempts);
+-
+-      if (attempts === 2) {
+-        operation.stop();
+-
+-        assert.strictEqual(attempts, 2);
+-        assert.strictEqual(operation.attempts(), attempts);
+-        assert.strictEqual(operation.mainError(), error);
+-        finalCallback();
+-      }
+-
+-      if (operation.retry(error)) {
+-        return;
+-      }
+-    });
+-  };
+-
+-  fn();
+-})();
+Index: node-retry/test/integration/test-retry-wrap.js
+===================================================================
+--- node-retry.orig/test/integration/test-retry-wrap.js
++++ node-retry/test/integration/test-retry-wrap.js
+@@ -1,6 +1,5 @@
+ var common = require('../common');
+ var assert = common.assert;
+-var fake = common.fake.create();
+ var retry = require(common.dir.lib + '/retry');
+ 
+ function getLib() {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..1bd9fa1
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+00-fake.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-retry.git



More information about the Pkg-javascript-commits mailing list