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

Commit 503e5ac

Browse files
author
Alan Shaw
authored
fix: make clear pins function in tests serial (#1910)
refs #1890 License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 9470900 commit 503e5ac

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

test/core/pin.js

+12-15
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,18 @@ describe('pin', function () {
5454
.then(result => expect(result.pinned).to.eql(pinned))
5555
}
5656

57-
function clearPins () {
58-
return pin.ls()
59-
.then(ls => {
60-
const pinsToRemove = ls
61-
.filter(out => out.type === pinTypes.recursive)
62-
.map(out => pin.rm(out.hash))
63-
return Promise.all(pinsToRemove)
64-
})
65-
.then(() => pin.ls())
66-
.then(ls => {
67-
const pinsToRemove = ls
68-
.filter(out => out.type === pinTypes.direct)
69-
.map(out => pin.rm(out.hash))
70-
return Promise.all(pinsToRemove)
71-
})
57+
async function clearPins () {
58+
let ls = (await pin.ls()).filter(out => out.type === pinTypes.recursive)
59+
60+
for (let i = 0; i < ls.length; i++) {
61+
await pin.rm(ls[i].hash)
62+
}
63+
64+
ls = (await pin.ls()).filter(out => out.type === pinTypes.direct)
65+
66+
for (let i = 0; i < ls.length; i++) {
67+
await pin.rm(ls[i].hash)
68+
}
7269
}
7370

7471
before(function (done) {

0 commit comments

Comments
 (0)