You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by ro...@apache.org on 2015/07/12 14:00:38 UTC

[11/59] [abbrv] couchdb-nmo git commit: tests: fixes & raise coverage again

tests: fixes & raise coverage again

 - back to 100% code coverage
 - pin to lab-babel 1.0.0


Project: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/commit/d9c91bd3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/tree/d9c91bd3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/diff/d9c91bd3

Branch: refs/heads/master
Commit: d9c91bd3de198442c5c20b49ca0c8aa8b418d800
Parents: a67e6ba
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Fri May 22 22:44:18 2015 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Fri May 22 23:13:37 2015 +0200

----------------------------------------------------------------------
 package.json     |  2 +-
 test/common.js   |  4 ++--
 test/isonline.js |  8 ++++++++
 test/utils.js    | 14 ++++++++++++++
 4 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/d9c91bd3/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index e861efc..8095998 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
   "devDependencies": {
     "babel": "^5.1.10",
     "lab": "~5.5.1",
-    "lab-babel": "~1.0.0",
+    "lab-babel": "1.0.0",
     "less": "~2.5.0",
     "marked-man": "~0.1.4",
     "node-doc-generator": "robertkowalski/node-documentation-generator#sloppy"

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/d9c91bd3/test/common.js
----------------------------------------------------------------------
diff --git a/test/common.js b/test/common.js
index 511905c..3e19963 100644
--- a/test/common.js
+++ b/test/common.js
@@ -20,11 +20,11 @@ export function createTestServers () {
 }
 
 export function stopTestServers (servers) {
-  const servers = servers.map((s) => {
+  const s = servers.map((s) => {
     const close = Promise.promisify(s.close).bind(s);
     return close();
   });
-  return Promise.all(servers);
+  return Promise.all(s);
 }
 
 export function createTestServer (port) {

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/d9c91bd3/test/isonline.js
----------------------------------------------------------------------
diff --git a/test/isonline.js b/test/isonline.js
index fc81f17..da0e3b7 100644
--- a/test/isonline.js
+++ b/test/isonline.js
@@ -86,6 +86,14 @@ lab.experiment('isonline', () => {
         });
     });
 
+    lab.test('returns an error for non http urls', (done) => {
+      isonline('ftp://127.0.0.1:65516')
+        .catch((err) => {
+          assert.ok(err instanceof Error);
+          done();
+        });
+    });
+
     lab.test('returns false for down site with bad DNS', (done) => {
       isonline('http://exampleneverexists')
         .then((res) => {

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/d9c91bd3/test/utils.js
----------------------------------------------------------------------
diff --git a/test/utils.js b/test/utils.js
index 2beef5c..41a31ea 100644
--- a/test/utils.js
+++ b/test/utils.js
@@ -98,3 +98,17 @@ lab.experiment('utils: send json to node', () => {
       });
   });
 });
+
+lab.experiment('utils: removeUsernamePw', () => {
+  lab.test('removes credentials', (done) => {
+    var res = utils.removeUsernamePw('https://foo:bar@example.com');
+    assert.equal(res, 'https://USER:PW@example.com/');
+    done();
+  });
+
+  lab.test('keeps other urls valid', (done) => {
+    var res = utils.removeUsernamePw('https://example.com');
+    assert.equal(res, 'https://example.com/');
+    done();
+  });
+});