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

Commit b2a77d6

Browse files
achingbrainalanshaw
authored andcommitted
fix: add test data to IPFS before fetching it (#832)
1 parent ff7c7e5 commit b2a77d6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Diff for: test/dag.spec.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ chai.use(dirtyChai)
1010
const series = require('async/series')
1111
const dagPB = require('ipld-dag-pb')
1212
const DAGNode = dagPB.DAGNode
13-
13+
const CID = require('cids')
1414
const IPFSApi = require('../src')
1515
const f = require('./utils/factory')
1616

@@ -71,12 +71,17 @@ describe('.dag', function () {
7171
})
7272

7373
it('should callback with error when missing DAG resolver for raw multicodec', (done) => {
74-
// CIDv1 with multicodec = raw
75-
const cid = 'bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy'
76-
ipfs.dag.get(cid, (err, result) => {
77-
expect(result).to.not.exist()
78-
expect(err.message).to.equal('ipfs-api is missing DAG resolver for "raw" multicodec')
79-
done()
74+
ipfs.dag.put(Buffer.from([0, 1, 2, 3]), {
75+
// CIDv1 with multicodec = raw
76+
cid: new CID('bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy')
77+
}, (err, cid) => {
78+
expect(err).to.not.exist()
79+
80+
ipfs.dag.get(cid, (err, result) => {
81+
expect(result).to.not.exist()
82+
expect(err.message).to.equal('ipfs-api is missing DAG resolver for "raw" multicodec')
83+
done()
84+
})
8085
})
8186
})
8287
})

0 commit comments

Comments
 (0)