Skip to content

Commit

Permalink
fix clear test
Browse files Browse the repository at this point in the history
  • Loading branch information
natzcam committed Jan 13, 2025
1 parent 4dcd610 commit acdfae3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/blobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test('handle invalid range header', async function (t) {
})

test('server could clear blobs', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const core = store.get({ name: 'test' })
await core.append([Buffer.from('abc'), Buffer.from('d'), Buffer.from('efg')])
Expand Down
11 changes: 7 additions & 4 deletions test/drives.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ test('can select a file for full download', async function (t) {
await dl.done()
})

test.solo('server could clear files', async function (t) {
const store = new Corestore(RAM)
test('server could clear files', async function (t) {
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -189,10 +189,13 @@ test.solo('server could clear files', async function (t) {
const server = testBlobServer(t, store)
await server.listen()

t.is((await drive.blobs.get({ blockOffset: 0, blockLength: 1, byteOffset: 0, byteLength: 4 }, { wait: false })).toString(), 'Here')
t.is((await drive.blobs.get({ blockOffset: 1, blockLength: 1, byteOffset: 4, byteLength: 3 }, { wait: false })).toString(), 'IAm')

await server.clear(drive.key, {
filename: '/file2.txt'
})

t.ok(await drive.entry('/file.txt'))
t.is(await drive.entry('/file2.txt'), null)
t.is((await drive.blobs.get({ blockOffset: 0, blockLength: 1, byteOffset: 0, byteLength: 4 }, { wait: false })).toString(), 'Here')
t.is(await drive.blobs.get({ blockOffset: 1, blockLength: 1, byteOffset: 4, byteLength: 3 }, { wait: false }), null)
})

0 comments on commit acdfae3

Please sign in to comment.