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

test: add promised tests for optionless dag.put #338

Merged
merged 3 commits into from
Aug 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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