From 2e0defd36336b8d6220bb0b96087a40765ae2e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=98=D0=BB=D1=8C?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sun, 29 Jul 2018 15:43:21 +0300 Subject: [PATCH 1/3] test: add promised tests for optionless dag.put --- js/src/dag/put.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/src/dag/put.js b/js/src/dag/put.js index 42081a29..c918dad0 100644 --- a/js/src/dag/put.js +++ b/js/src/dag/put.js @@ -100,6 +100,10 @@ module.exports = (createCommon, options) => { ipfs.dag.put(cborNode, done) }) + it('should not fail when calling put without options (promised)', (done) => { + return ipfs.dag.put(cborNode) + }) + it('should set defaults when calling put without options', (done) => { ipfs.dag.put(cborNode, (err, cid) => { expect(err).to.not.exist() @@ -108,6 +112,14 @@ module.exports = (createCommon, options) => { done() }) }) + + it('should set defaults when calling put without options (promised)', () => { + return ipfs.dag.put(cborNode) + .then((cid) => { + expect(cid.codec).to.equal('dag-cbor') + expect(multihash.decode(cid.multihash).name).to.equal('sha2-256') + }) + }) it('should override hash algoritm default and resolve with it', (done) => { ipfs.dag.put(cborNode, { From e460b62fbf50fbd8204acb68c75429938fb6b75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=98=D0=BB=D1=8C?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sun, 29 Jul 2018 15:46:13 +0300 Subject: [PATCH 2/3] chore: remove unnecessary done --- js/src/dag/put.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/dag/put.js b/js/src/dag/put.js index c918dad0..41942856 100644 --- a/js/src/dag/put.js +++ b/js/src/dag/put.js @@ -100,7 +100,7 @@ module.exports = (createCommon, options) => { ipfs.dag.put(cborNode, done) }) - it('should not fail when calling put without options (promised)', (done) => { + it('should not fail when calling put without options (promised)', () => { return ipfs.dag.put(cborNode) }) From 0677f5189730e85db66f8a3bfd05093c3bd12e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=98=D0=BB=D1=8C?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sun, 29 Jul 2018 15:57:52 +0300 Subject: [PATCH 3/3] chore: remove trailing spaces --- js/src/dag/put.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/dag/put.js b/js/src/dag/put.js index 41942856..f5996fff 100644 --- a/js/src/dag/put.js +++ b/js/src/dag/put.js @@ -102,8 +102,8 @@ module.exports = (createCommon, options) => { it('should not fail when calling put without options (promised)', () => { return ipfs.dag.put(cborNode) - }) - + }) + it('should set defaults when calling put without options', (done) => { ipfs.dag.put(cborNode, (err, cid) => { expect(err).to.not.exist() @@ -112,7 +112,7 @@ module.exports = (createCommon, options) => { done() }) }) - + it('should set defaults when calling put without options (promised)', () => { return ipfs.dag.put(cborNode) .then((cid) => {