Skip to content

Commit

Permalink
test again storage
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Jan 6, 2025
1 parent 524f274 commit d891728
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"corestore": "^6.18.4",
"hyperblobs": "^2.7.4",
"hyperdrive": "^11.13.3",
"random-access-memory": "^6.2.1",
"standard": "^17.1.2"
},
"repository": {
Expand Down
18 changes: 9 additions & 9 deletions test/blobs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const test = require('brittle')
const b4a = require('b4a')
const RAM = require('random-access-memory')
const tmp = require('test-tmp')
const Corestore = require('corestore')
const { testBlobServer, request, testHyperblobs } = require('./helpers')

test('can get blob from hypercore', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand All @@ -21,7 +21,7 @@ test('can get blob from hypercore', async function (t) {
})

test('can get encrypted blob from hypercore', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand All @@ -41,7 +41,7 @@ test('can get encrypted blob from hypercore', async function (t) {
})

test('can get blob from hypercore - multiple blocks', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)
blobs.blockSize = 4 // force multiple blocks
Expand All @@ -59,7 +59,7 @@ test('can get blob from hypercore - multiple blocks', async function (t) {
})

test('can get a partial blob from hypercore', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand All @@ -74,7 +74,7 @@ test('can get a partial blob from hypercore', async function (t) {
})

test('can get a partial blob from hypercore, but request the whole data', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand All @@ -89,7 +89,7 @@ test('can get a partial blob from hypercore, but request the whole data', async
})

test('handle out of range header end', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand All @@ -104,7 +104,7 @@ test('handle out of range header end', async function (t) {
})

test('handle range header without end', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand All @@ -119,7 +119,7 @@ test('handle range header without end', async function (t) {
})

test('handle invalid range header', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const blobs = testHyperblobs(t, store)

Expand Down
18 changes: 9 additions & 9 deletions test/drives.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const test = require('brittle')
const b4a = require('b4a')
const RAM = require('random-access-memory')
const tmp = require('test-tmp')
const Corestore = require('corestore')
const { testHyperdrive, testBlobServer, request, get } = require('./helpers')

test('can get file from hyperdrive', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -19,7 +19,7 @@ test('can get file from hyperdrive', async function (t) {
})

test('can get versioned file from hyperdrive', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -36,7 +36,7 @@ test('can get versioned file from hyperdrive', async function (t) {
})

test('404 if file not found', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -50,7 +50,7 @@ test('404 if file not found', async function (t) {
})

test('404 if token is invalid', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -66,7 +66,7 @@ test('404 if token is invalid', async function (t) {
})

test('sending request while suspended', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -85,7 +85,7 @@ test('sending request while suspended', async function (t) {
})

test('sending request after resume', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store)
await drive.put('/file.txt', 'Here')
Expand All @@ -102,7 +102,7 @@ test('sending request after resume', async function (t) {
})

test('can get encrypted blob from hyperdrive', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store, { encryptionKey: b4a.alloc(32) })
await drive.put('/file.txt', 'Here')
Expand All @@ -120,7 +120,7 @@ test('can get encrypted blob from hyperdrive', async function (t) {
})

test('can select a file for full download', async function (t) {
const store = new Corestore(RAM)
const store = new Corestore(await tmp())

const drive = testHyperdrive(t, store, { encryptionKey: b4a.alloc(32) })
await drive.put('/file.txt', 'Here')
Expand Down

0 comments on commit d891728

Please sign in to comment.