Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 59aa1d5

Browse files
negamaxialanshaw
authored andcommitted
test: add promised tests for optionless dag.put (#338)
* test: add promised tests for optionless dag.put * chore: remove unnecessary done * chore: remove trailing spaces
1 parent 8773c80 commit 59aa1d5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

js/src/dag/put.js

+12
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ module.exports = (createCommon, options) => {
100100
ipfs.dag.put(cborNode, done)
101101
})
102102

103+
it('should not fail when calling put without options (promised)', () => {
104+
return ipfs.dag.put(cborNode)
105+
})
106+
103107
it('should set defaults when calling put without options', (done) => {
104108
ipfs.dag.put(cborNode, (err, cid) => {
105109
expect(err).to.not.exist()
@@ -109,6 +113,14 @@ module.exports = (createCommon, options) => {
109113
})
110114
})
111115

116+
it('should set defaults when calling put without options (promised)', () => {
117+
return ipfs.dag.put(cborNode)
118+
.then((cid) => {
119+
expect(cid.codec).to.equal('dag-cbor')
120+
expect(multihash.decode(cid.multihash).name).to.equal('sha2-256')
121+
})
122+
})
123+
112124
it('should override hash algoritm default and resolve with it', (done) => {
113125
ipfs.dag.put(cborNode, {
114126
format: 'dag-cbor',

0 commit comments

Comments
 (0)