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

Commit 87a0d89

Browse files
author
Alan Shaw
authored
test: pin.ls with multiple CIDs (#563)
* test: pin.ls with multiple CIDs * docs: document pin.ls CID parameter properly
1 parent 30cf0df commit 87a0d89

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

SPEC/PIN.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ A great source of [examples][] can be found in the tests for this API.
4848

4949
> List all the objects pinned to local storage or under a specific hash.
5050
51-
##### `ipfs.pin.ls([hash], [options])`
51+
##### `ipfs.pin.ls([cid], [options])`
5252

5353
Where:
5454

55-
- `hash` is an IPFS multihash.
55+
- `cid` - a [CID][cid] instance or CID as a string or an array of CIDs.
5656
- `options` is an object that can contain the following keys:
5757
- 'type' - Return also the type of pin (direct, indirect or recursive)
5858

@@ -107,3 +107,4 @@ console.log(pinset)
107107
A great source of [examples][] can be found in the tests for this API.
108108

109109
[examples]: https://github.com/ipfs/interface-ipfs-core/blob/master/src/pin
110+
[cid]: https://www.npmjs.com/package/cids

src/pin/ls.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,12 @@ module.exports = (createCommon, options) => {
140140
hash: fixtures.files[0].cid
141141
}])
142142
})
143+
144+
it('should list pins for multiple CIDs', async () => {
145+
const pinset = await ipfs.pin.ls([fixtures.files[0].cid, fixtures.files[1].cid])
146+
const cids = pinset.map(({ hash }) => hash)
147+
expect(cids).to.include(fixtures.files[0].cid)
148+
expect(cids).to.include(fixtures.files[1].cid)
149+
})
143150
})
144151
}

0 commit comments

Comments
 (0)