Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 1baf9f6

Browse files
committed
refactor: use only low-level APIs in dag.get test
Implements the same change as #2987 but using the unixfs-importer because go-ipfs does not support specifying CID versions to /block/put so the client has to create the CID and supply it.
1 parent 99c3be5 commit 1baf9f6

File tree

1 file changed

+5
-1
lines changed
  • packages/interface-ipfs-core/src/dag

1 file changed

+5
-1
lines changed

packages/interface-ipfs-core/src/dag/get.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
const dagPB = require('ipld-dag-pb')
55
const DAGNode = dagPB.DAGNode
66
const dagCBOR = require('ipld-dag-cbor')
7+
const importer = require('ipfs-unixfs-importer')
78
const Unixfs = require('ipfs-unixfs')
89
const all = require('it-all')
910
const { getDescribe, getIt, expect } = require('../utils/mocha')
@@ -154,7 +155,10 @@ module.exports = (common, options) => {
154155
it('should get a node added as CIDv1 with a CIDv0', async () => {
155156
const input = Buffer.from(`TEST${Math.random()}`)
156157

157-
const res = await all(ipfs.add(input, { cidVersion: 1, rawLeaves: false }))
158+
const res = await all(importer([{ content: input }], ipfs.block, {
159+
cidVersion: 1,
160+
rawLeaves: false
161+
}))
158162

159163
const cidv1 = res[0].cid
160164
expect(cidv1.version).to.equal(1)

0 commit comments

Comments
 (0)