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

fix: add test data to IPFS before fetching it #832

Merged
merged 1 commit into from
Aug 14, 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
19 changes: 12 additions & 7 deletions test/dag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ chai.use(dirtyChai)
const series = require('async/series')
const dagPB = require('ipld-dag-pb')
const DAGNode = dagPB.DAGNode

const CID = require('cids')
const IPFSApi = require('../src')
const f = require('./utils/factory')

Expand Down Expand Up @@ -71,12 +71,17 @@ describe('.dag', function () {
})

it('should callback with error when missing DAG resolver for raw multicodec', (done) => {
// CIDv1 with multicodec = raw
const cid = 'bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy'
ipfs.dag.get(cid, (err, result) => {
expect(result).to.not.exist()
expect(err.message).to.equal('ipfs-api is missing DAG resolver for "raw" multicodec')
done()
ipfs.dag.put(Buffer.from([0, 1, 2, 3]), {
// CIDv1 with multicodec = raw
cid: new CID('bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy')
}, (err, cid) => {
expect(err).to.not.exist()

ipfs.dag.get(cid, (err, result) => {
expect(result).to.not.exist()
expect(err.message).to.equal('ipfs-api is missing DAG resolver for "raw" multicodec')
done()
})
})
})
})