Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ed0c8f3

Browse files
committed
test: add test to make sure we do not pin when sending pin=false
1 parent 976e955 commit ed0c8f3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/http-api/inject/dag.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,25 @@ module.exports = (http) => {
277277

278278
expect(pinset.map(pin => pin.hash)).to.contain(cid.toBaseEncodedString('base58btc'))
279279
})
280+
281+
it('does not pin a node after adding', async () => {
282+
const node = {
283+
foo: 'bar'
284+
}
285+
286+
const res = await api.inject({
287+
method: 'POST',
288+
url: '/api/v0/dag/put?pin=false',
289+
...await toHeadersAndPayload(JSON.stringify(node))
290+
})
291+
292+
expect(res.statusCode).to.equal(200)
293+
294+
const cid = new CID(res.result.Cid['/'])
295+
const pinset = await http.api._ipfs.pin.ls()
296+
297+
expect(pinset.map(pin => pin.hash)).to.not.contain(cid.toBaseEncodedString('base58btc'))
298+
})
280299
})
281300

282301
describe('/dag/resolve', () => {

0 commit comments

Comments
 (0)