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

Commit

Permalink
fix: add test data to IPFS before fetching it (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored and alanshaw committed Aug 14, 2018
1 parent ff7c7e5 commit b2a77d6
Showing 1 changed file with 12 additions and 7 deletions.
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()
})
})
})
})

0 comments on commit b2a77d6

Please sign in to comment.