Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module.exports = class RAM extends RandomAccess {
}

_unlink (req) {
this._buffers = []
this.buffers = []
this.length = 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering for a bit if pageSize should also be reset here but I guess it makes sense for it to keep its initial value from the constructor.

req.callback(null, null)
}
Expand Down
15 changes: 15 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,18 @@ test('clone', function (t) {
})
})
})

test('unlink', function (t) {
t.plan(4)

const file = new RAM()

file.write(0, Buffer.from('hello'), function (err) {
t.absent(err, 'no error')
file.unlink(function (err) {
t.absent(err, 'no error')
t.is(0, file.buffers.length, 'no buffer')
t.is(0, file.length, 'no length')
})
})
})