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

Commit eb7c038

Browse files
committed
Get tests passing with pin core changes
1 parent bae9462 commit eb7c038

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/pin.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ module.exports = (common) => {
5050

5151
describe('callback API', () => {
5252
// 1st, because ipfs.files.add pins automatically
53+
it('.ls type recursive', (done) => {
54+
ipfs.pin.ls({ type: 'recursive' }, (err, pinset) => {
55+
expect(err).to.not.exist()
56+
expect(pinset).to.not.be.empty()
57+
done()
58+
})
59+
})
60+
61+
it('.ls type indirect', (done) => {
62+
ipfs.pin.ls({ type: 'indirect' }, (err, pinset) => {
63+
expect(err).to.not.exist()
64+
// because the pinned file has no links
65+
expect(pinset).to.be.empty()
66+
done()
67+
})
68+
})
69+
5370
it('.rm', (done) => {
5471
const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
5572

@@ -69,7 +86,7 @@ module.exports = (common) => {
6986

7087
ipfs.pin.add(hash, { recursive: false }, (err, pinset) => {
7188
expect(err).to.not.exist()
72-
expect(pinset[0]).to.be.equal(hash)
89+
expect(pinset[0].hash).to.be.equal(hash)
7390
done()
7491
})
7592
})
@@ -90,22 +107,6 @@ module.exports = (common) => {
90107
})
91108
})
92109

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

@@ -123,7 +124,7 @@ module.exports = (common) => {
123124

124125
return ipfs.pin.add(hash, { recursive: false })
125126
.then((pinset) => {
126-
expect(pinset[0]).to.be.equal(hash)
127+
expect(pinset[0].hash).to.be.equal(hash)
127128
})
128129
})
129130

0 commit comments

Comments
 (0)