@@ -19,7 +19,7 @@ test('write and read', function (t) {
19
19
file . read ( 0 , 5 , function ( err , buf ) {
20
20
t . absent ( err , 'no error' )
21
21
t . alike ( buf , Buffer . from ( 'hello' ) )
22
- file . destroy ( ( ) => t . pass ( ) )
22
+ file . unlink ( ( ) => t . pass ( ) )
23
23
} )
24
24
} )
25
25
} )
@@ -31,7 +31,7 @@ test('read before write', function (t) {
31
31
32
32
file . read ( 0 , 0 , function ( err , buf ) {
33
33
t . ok ( err , 'not created' )
34
- file . destroy ( ( ) => t . pass ( ) )
34
+ file . unlink ( ( ) => t . pass ( ) )
35
35
} )
36
36
} )
37
37
@@ -42,7 +42,7 @@ test('read range before write', function (t) {
42
42
43
43
file . read ( 0 , 5 , function ( err , buf ) {
44
44
t . ok ( err , 'not created' )
45
- file . destroy ( ( ) => t . pass ( ) )
45
+ file . unlink ( ( ) => t . pass ( ) )
46
46
} )
47
47
} )
48
48
@@ -55,7 +55,7 @@ test('read range > file', function (t) {
55
55
t . absent ( err , 'no error' )
56
56
file . read ( 0 , 10 , function ( err , buf ) {
57
57
t . ok ( err , 'not satisfiable' )
58
- file . destroy ( ( ) => t . pass ( ) )
58
+ file . unlink ( ( ) => t . pass ( ) )
59
59
} )
60
60
} )
61
61
} )
@@ -130,7 +130,7 @@ test('truncate with size', function (t) {
130
130
file . stat ( function ( err , st ) {
131
131
t . absent ( err , 'no error' )
132
132
t . is ( st . size , 100 )
133
- file . destroy ( ( ) => t . pass ( ) )
133
+ file . unlink ( ( ) => t . pass ( ) )
134
134
} )
135
135
} )
136
136
@@ -159,7 +159,7 @@ test('mkdir path', function (t) {
159
159
file . read ( 0 , 5 , function ( err , buf ) {
160
160
t . absent ( err , 'no error' )
161
161
t . alike ( buf , Buffer . from ( 'hello' ) )
162
- file . destroy ( ( ) => t . pass ( ) )
162
+ file . unlink ( ( ) => t . pass ( ) )
163
163
} )
164
164
} )
165
165
} )
@@ -192,7 +192,7 @@ test('write/read big chunks', async function (t) {
192
192
193
193
await io
194
194
195
- file . destroy ( ( ) => t . pass ( ) )
195
+ file . unlink ( ( ) => t . pass ( ) )
196
196
} )
197
197
198
198
test ( 'rmdir option' , function ( t ) {
@@ -206,11 +206,11 @@ test('rmdir option', function (t) {
206
206
file . read ( 0 , 2 , function ( err , buf ) {
207
207
t . absent ( err , 'no error' )
208
208
t . alike ( buf , Buffer . from ( 'hi' ) )
209
- file . destroy ( ondestroy )
209
+ file . unlink ( onunlink )
210
210
} )
211
211
} )
212
212
213
- function ondestroy ( err ) {
213
+ function onunlink ( err ) {
214
214
t . absent ( err , 'no error' )
215
215
fs . stat ( path . join ( tmp , 'rmdir' ) , function ( err ) {
216
216
t . is ( err && err . code , 'ENOENT' , 'should be removed' )
@@ -231,11 +231,11 @@ test('rmdir option with non empty parent', function (t) {
231
231
file . read ( 0 , 2 , function ( err , buf ) {
232
232
t . absent ( err , 'no error' )
233
233
t . alike ( buf , Buffer . from ( 'hi' ) )
234
- file . destroy ( ondestroy )
234
+ file . unlink ( onunlink )
235
235
} )
236
236
} )
237
237
238
- function ondestroy ( err ) {
238
+ function onunlink ( err ) {
239
239
t . absent ( err , 'no error' )
240
240
fs . stat ( path . join ( tmp , 'rmdir' ) , function ( err ) {
241
241
t . absent ( err , 'should not be removed' )
@@ -264,7 +264,7 @@ test('del, partial file block', function (t) {
264
264
file . read ( 50 , 50 , function ( err , buf ) {
265
265
t . absent ( err , 'no error' )
266
266
t . alike ( buf , Buffer . alloc ( 50 ) )
267
- file . destroy ( ( ) => t . pass ( ) )
267
+ file . unlink ( ( ) => t . pass ( ) )
268
268
} )
269
269
} )
270
270
} )
@@ -289,7 +289,7 @@ test('del, whole file block', function (t) {
289
289
t . absent ( err , 'no error' )
290
290
t . comment ( before . blocks + ' -> ' + after . blocks + ' blocks' )
291
291
t . ok ( after . blocks < before . blocks , 'fewer blocks' )
292
- file . destroy ( ( ) => t . pass ( ) )
292
+ file . unlink ( ( ) => t . pass ( ) )
293
293
} )
294
294
} )
295
295
} )
@@ -314,7 +314,7 @@ test('del, partial and whole', function (t) {
314
314
t . absent ( err , 'no error' )
315
315
t . comment ( before . blocks + ' -> ' + after . blocks + ' blocks' )
316
316
t . ok ( after . blocks < before . blocks , 'fewer blocks' )
317
- file . destroy ( ( ) => t . pass ( ) )
317
+ file . unlink ( ( ) => t . pass ( ) )
318
318
} )
319
319
} )
320
320
} )
@@ -333,7 +333,7 @@ test('del, infinity', function (t) {
333
333
file . stat ( function ( err , st ) {
334
334
t . absent ( err , 'no error' )
335
335
t . is ( st . size , 0 )
336
- file . destroy ( ( ) => t . pass ( ) )
336
+ file . unlink ( ( ) => t . pass ( ) )
337
337
} )
338
338
} )
339
339
} )
@@ -353,7 +353,7 @@ test('truncate', function (t) {
353
353
file . stat ( function ( err , st ) {
354
354
t . absent ( err , 'no error' )
355
355
t . is ( st . size , 20 )
356
- file . destroy ( ( ) => t . pass ( ) )
356
+ file . unlink ( ( ) => t . pass ( ) )
357
357
} )
358
358
} )
359
359
} )
@@ -397,21 +397,6 @@ test('open and close many times', function (t) {
397
397
}
398
398
} )
399
399
400
- test ( 'trigger bad open' , function ( t ) {
401
- t . plan ( 3 )
402
-
403
- const file = new RAF ( gen ( ) , { truncate : true } )
404
-
405
- file . fd = 10000
406
- file . open ( function ( err ) {
407
- t . ok ( err , 'should error trying to close old fd' )
408
- file . open ( function ( err ) {
409
- t . absent ( err , 'no error' )
410
- file . destroy ( ( ) => t . pass ( ) )
411
- } )
412
- } )
413
- } )
414
-
415
400
test ( 'cannot escape directory' , function ( t ) {
416
401
t . plan ( 2 )
417
402
@@ -430,7 +415,7 @@ test('directory filename resolves correctly', function (t) {
430
415
t . is ( file . filename , path . join ( tmp , name ) )
431
416
} )
432
417
433
- test ( 'destroy ' , async function ( t ) {
418
+ test ( 'unlink ' , async function ( t ) {
434
419
t . plan ( 5 )
435
420
436
421
const name = gen ( )
@@ -441,11 +426,11 @@ test('destroy', async function (t) {
441
426
file . read ( 0 , 2 , function ( err , buf ) {
442
427
t . absent ( err , 'no error' )
443
428
t . alike ( buf , Buffer . from ( 'hi' ) )
444
- file . destroy ( ondestroy )
429
+ file . unlink ( onunlink )
445
430
} )
446
431
} )
447
432
448
- function ondestroy ( err ) {
433
+ function onunlink ( err ) {
449
434
t . absent ( err , 'no error' )
450
435
fs . stat ( name , function ( err ) {
451
436
t . is ( err && err . code , 'ENOENT' , 'should be removed' )
0 commit comments