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

Commit 2d4e86f

Browse files
committed
feat: additional tests for indirect pin.ls
License: MIT Signed-off-by: Marcin Rataj <[email protected]>
1 parent 60c3c12 commit 2d4e86f

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

js/src/pin/ls.js

+26-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = (createCommon, options) => {
3333
parallel([
3434
// two files wrapped in a directory, root CID pinned recursively
3535
(cb) => {
36-
const dir = fixtures.directory.files.map((file) => ({path: file.path, content: file.data}))
36+
const dir = fixtures.directory.files.map((file) => ({ path: file.path, content: file.data }))
3737
ipfs.files.add(dir, { pin: false }, (err, res) => {
3838
if (err) return cb(err)
3939
ipfs.pin.add(fixtures.directory.cid, { recursive: true }, cb)
@@ -90,6 +90,14 @@ module.exports = (createCommon, options) => {
9090
type: 'recursive',
9191
hash: fixtures.directory.cid
9292
})
93+
expect(pinset).to.deep.include({
94+
type: 'indirect',
95+
hash: fixtures.directory.files[0].cid
96+
})
97+
expect(pinset).to.deep.include({
98+
type: 'indirect',
99+
hash: fixtures.directory.files[1].cid
100+
})
93101
done()
94102
})
95103
})
@@ -112,6 +120,14 @@ module.exports = (createCommon, options) => {
112120
type: 'direct',
113121
hash: fixtures.files[1].cid
114122
})
123+
expect(pinset).to.deep.include({
124+
type: 'indirect',
125+
hash: fixtures.directory.files[0].cid
126+
})
127+
expect(pinset).to.deep.include({
128+
type: 'indirect',
129+
hash: fixtures.directory.files[1].cid
130+
})
115131
done()
116132
})
117133
})
@@ -134,12 +150,21 @@ module.exports = (createCommon, options) => {
134150
type: 'direct',
135151
hash: fixtures.files[1].cid
136152
})
153+
expect(pinset).to.deep.include({
154+
type: 'indirect',
155+
hash: fixtures.directory.files[0].cid
156+
})
157+
expect(pinset).to.deep.include({
158+
type: 'indirect',
159+
hash: fixtures.directory.files[1].cid
160+
})
137161
})
138162
})
139163

140164
it('should list all direct pins', (done) => {
141165
ipfs.pin.ls({ type: 'direct' }, (err, pinset) => {
142166
expect(err).to.not.exist()
167+
expect(pinset).to.have.lengthOf(1)
143168
expect(pinset).to.deep.include({
144169
type: 'direct',
145170
hash: fixtures.files[1].cid

0 commit comments

Comments
 (0)