4
4
const dagPB = require ( 'ipld-dag-pb' )
5
5
const DAGNode = dagPB . DAGNode
6
6
const dagCBOR = require ( 'ipld-dag-cbor' )
7
+ const all = require ( 'it-all' )
7
8
const { getDescribe, getIt, expect } = require ( '../utils/mocha' )
8
9
9
10
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
@@ -42,27 +43,27 @@ module.exports = (common, options) => {
42
43
} )
43
44
44
45
it ( 'should get tree with CID' , async ( ) => {
45
- const paths = await ipfs . dag . tree ( cidCbor )
46
+ const paths = await all ( ipfs . dag . tree ( cidCbor ) )
46
47
expect ( paths ) . to . eql ( [
47
48
'pb' ,
48
49
'someData'
49
50
] )
50
51
} )
51
52
52
53
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' ) )
54
55
expect ( paths ) . to . eql ( [ ] )
55
56
} )
56
57
57
58
it ( 'should get tree with CID and path as String' , async ( ) => {
58
59
const cidCborStr = cidCbor . toBaseEncodedString ( )
59
60
60
- const paths = await ipfs . dag . tree ( cidCborStr + '/someData' )
61
+ const paths = await all ( ipfs . dag . tree ( cidCborStr + '/someData' ) )
61
62
expect ( paths ) . to . eql ( [ ] )
62
63
} )
63
64
64
65
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 } ) )
66
67
expect ( paths ) . to . have . members ( [
67
68
'pb' ,
68
69
'someData' ,
@@ -72,7 +73,7 @@ module.exports = (common, options) => {
72
73
} )
73
74
74
75
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 } ) )
76
77
expect ( paths ) . to . have . members ( [
77
78
'Links' ,
78
79
'Data'
0 commit comments