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

Commit 6264299

Browse files
author
Alan Shaw
committed
fix: dag.tree tests
1 parent cfb6a45 commit 6264299

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/dag/tree.js

Lines changed: 6 additions & 5 deletions
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 all = require('it-all')
78
const { getDescribe, getIt, expect } = require('../utils/mocha')
89

910
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
@@ -42,27 +43,27 @@ module.exports = (common, options) => {
4243
})
4344

4445
it('should get tree with CID', async () => {
45-
const paths = await ipfs.dag.tree(cidCbor)
46+
const paths = await all(ipfs.dag.tree(cidCbor))
4647
expect(paths).to.eql([
4748
'pb',
4849
'someData'
4950
])
5051
})
5152

5253
it('should get tree with CID and path', async () => {
53-
const paths = await ipfs.dag.tree(cidCbor, 'someData')
54+
const paths = await all(ipfs.dag.tree(cidCbor, 'someData'))
5455
expect(paths).to.eql([])
5556
})
5657

5758
it('should get tree with CID and path as String', async () => {
5859
const cidCborStr = cidCbor.toBaseEncodedString()
5960

60-
const paths = await ipfs.dag.tree(cidCborStr + '/someData')
61+
const paths = await all(ipfs.dag.tree(cidCborStr + '/someData'))
6162
expect(paths).to.eql([])
6263
})
6364

6465
it('should get tree with CID recursive (accross different formats)', async () => {
65-
const paths = await ipfs.dag.tree(cidCbor, { recursive: true })
66+
const paths = await all(ipfs.dag.tree(cidCbor, { recursive: true }))
6667
expect(paths).to.have.members([
6768
'pb',
6869
'someData',
@@ -72,7 +73,7 @@ module.exports = (common, options) => {
7273
})
7374

7475
it('should get tree with CID and path recursive', async () => {
75-
const paths = await ipfs.dag.tree(cidCbor, 'pb', { recursive: true })
76+
const paths = await all(ipfs.dag.tree(cidCbor, 'pb', { recursive: true }))
7677
expect(paths).to.have.members([
7778
'Links',
7879
'Data'

0 commit comments

Comments
 (0)