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

Commit c1cfa2a

Browse files
committed
Get tests passing with pin core changes
1 parent dad7f81 commit c1cfa2a

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/pin.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,26 @@ module.exports = (common) => {
4646
common.teardown(done)
4747
})
4848

49-
describe('callback API', () => {
49+
describe('callback API', function () {
50+
this.timeout(20 * 1000)
5051
// 1st, because ipfs.files.add pins automatically
52+
it('.ls type recursive', (done) => {
53+
ipfs.pin.ls({ type: 'recursive' }, (err, pinset) => {
54+
expect(err).to.not.exist
55+
expect(pinset).to.not.be.empty
56+
done()
57+
})
58+
})
59+
60+
it('.ls type indirect', (done) => {
61+
ipfs.pin.ls({ type: 'indirect' }, (err, pinset) => {
62+
expect(err).to.not.exist
63+
// expect empty for now since the object has no links
64+
expect(pinset).to.be.empty
65+
done()
66+
})
67+
})
68+
5169
it('.rm', (done) => {
5270
const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
5371

@@ -67,7 +85,7 @@ module.exports = (common) => {
6785

6886
ipfs.pin.add(hash, { recursive: false }, (err, pinset) => {
6987
expect(err).to.not.exist
70-
expect(pinset[0]).to.be.equal(hash)
88+
expect(pinset[0].hash).to.be.equal(hash)
7189
done()
7290
})
7391
})
@@ -88,22 +106,6 @@ module.exports = (common) => {
88106
})
89107
})
90108

91-
it('.ls type indirect', (done) => {
92-
ipfs.pin.ls({ type: 'indirect' }, (err, pinset) => {
93-
expect(err).to.not.exist
94-
expect(pinset).to.not.be.empty
95-
done()
96-
})
97-
})
98-
99-
it('.ls type recursive', (done) => {
100-
ipfs.pin.ls({ type: 'recursive' }, (err, pinset) => {
101-
expect(err).to.not.exist
102-
expect(pinset).to.not.be.empty
103-
done()
104-
})
105-
})
106-
107109
it('.ls for a specific hash', (done) => {
108110
const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
109111

@@ -121,7 +123,7 @@ module.exports = (common) => {
121123

122124
return ipfs.pin.add(hash, { recursive: false })
123125
.then((pinset) => {
124-
expect(pinset[0]).to.be.equal(hash)
126+
expect(pinset[0].hash).to.be.equal(hash)
125127
})
126128
})
127129

0 commit comments

Comments
 (0)