2
2
3
3
import fs from 'fs'
4
4
import all from 'it-all'
5
+ import last from 'it-last'
6
+ import drain from 'it-drain'
5
7
import { tmpPath , removeAllPins } from './utils/pin-utils.js'
6
8
import { expect } from 'aegir/utils/chai.js'
7
9
import { daemonFactory } from './utils/daemon-factory.js'
@@ -68,7 +70,7 @@ describe('pin', function () {
68
70
// Pinning a large file recursively results in the same pins
69
71
it ( 'pin recursively' , async function ( ) {
70
72
async function pipeline ( daemon ) {
71
- const { cid } = await daemon . api . add ( jupiter , { pin : false } )
73
+ const { cid } = await last ( daemon . api . addAll ( jupiter , { pin : false } ) )
72
74
await daemon . api . pin . add ( cid )
73
75
74
76
return all ( daemon . api . pin . ls ( ) )
@@ -84,7 +86,7 @@ describe('pin', function () {
84
86
// Pinning a large file with recursive=false results in the same direct pin
85
87
it ( 'pin directly' , async function ( ) {
86
88
async function pipeline ( daemon ) {
87
- const { cid } = await daemon . api . add ( jupiter , { pin : false } )
89
+ const { cid } = await last ( daemon . api . addAll ( jupiter , { pin : false } ) )
88
90
await daemon . api . pin . add ( cid , { recursive : false } )
89
91
90
92
return all ( daemon . api . pin . ls ( ) )
@@ -103,7 +105,7 @@ describe('pin', function () {
103
105
// not part of another pin's dag
104
106
it ( 'pin recursively, remove the root pin' , async function ( ) {
105
107
async function pipeline ( daemon ) {
106
- const { cid } = await daemon . api . add ( jupiter )
108
+ const { cid } = await last ( daemon . api . addAll ( jupiter ) )
107
109
await daemon . api . pin . rm ( cid )
108
110
109
111
return all ( daemon . api . pin . ls ( ) )
@@ -120,7 +122,7 @@ describe('pin', function () {
120
122
it ( 'remove a child shared by multiple pins' , async function ( ) {
121
123
let jupiterDir
122
124
async function pipeline ( daemon ) {
123
- const { cid } = await daemon . api . add ( jupiter , { pin : false , wrapWithDirectory : true } )
125
+ const { cid } = await last ( daemon . api . addAll ( jupiter , { pin : false , wrapWithDirectory : true } ) )
124
126
jupiterDir = jupiterDir || await daemon . api . files . stat ( `/ipfs/${ cid } /test/fixtures/planets` )
125
127
126
128
// by separately pinning all the DAG nodes created when adding,
@@ -154,7 +156,7 @@ describe('pin', function () {
154
156
describe ( 'ls' , function ( ) {
155
157
it ( 'print same pins' , async function ( ) {
156
158
async function pipeline ( daemon ) {
157
- await daemon . api . add ( jupiter )
159
+ await drain ( daemon . api . addAll ( jupiter ) )
158
160
159
161
return all ( daemon . api . pin . ls ( ) )
160
162
}
0 commit comments