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

Commit

Permalink
test: add promised tests for optionless dag.put (#338)
Browse files Browse the repository at this point in the history
* test: add promised tests for optionless dag.put

* chore: remove unnecessary done

* chore: remove trailing spaces
  • Loading branch information
negamaxi authored and alanshaw committed Aug 2, 2018
1 parent 8773c80 commit 59aa1d5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/src/dag/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ module.exports = (createCommon, options) => {
ipfs.dag.put(cborNode, done)
})

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()
Expand All @@ -109,6 +113,14 @@ module.exports = (createCommon, options) => {
})
})

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, {
format: 'dag-cbor',
Expand Down

0 comments on commit 59aa1d5

Please sign in to comment.