Skip to content

Commit

Permalink
chore: appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed May 15, 2024
1 parent 047cd3b commit e272d97
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion packages/upload-api/test/storage/blobs-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ export class BlobsStorage {
const res = await fetch(url.toString())
if (res.status === 404) return error(new BlobNotFound(digest))
if (!res.ok || !res.body) {
throw new Error(`serverless blob storage failed to fetch from: ${url} status: ${res.status}`)
throw new Error(
`serverless blob storage failed to fetch from: ${url} status: ${res.status}`
)
}
return ok(res.body)
}
Expand Down
10 changes: 7 additions & 3 deletions packages/w3up-client/test/capability/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ export const IndexClient = Test.withContext({
customer: 'did:mailto:alice@web.mail',
consumer: space.did(),
})

const index = ShardedDAGIndex.create(car.cid)
const indexBytes = Result.unwrap(await index.archive())

const indexDigest = await alice.capability.blob.add(new Blob([indexBytes]))
assert.ok(await alice.capability.index.add(Link.create(0x0202, indexDigest)))
const indexDigest = await alice.capability.blob.add(
new Blob([indexBytes])
)
assert.ok(
await alice.capability.index.add(Link.create(0x0202, indexDigest))
)
},
},
})
Expand Down
17 changes: 9 additions & 8 deletions packages/w3up-client/test/helpers/bucket-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const server = createServer(async (req, res) => {
res.write(body)
}
} else if (req.method === 'PUT') {

const body = Buffer.concat(await collect(req))
data.set(key, body)
}
Expand All @@ -32,13 +31,15 @@ const server = createServer(async (req, res) => {
})

/** @param {import('node:stream').Readable} stream */
const collect = stream => {
return /** @type {Promise<Buffer[]>} */ (new Promise((resolve, reject) => {
const chunks = /** @type {Buffer[]} */ ([])
stream.on('data', chunk => chunks.push(Buffer.from(chunk)))
stream.on('error', err => reject(err))
stream.on('end', () => resolve(chunks))
}))
const collect = (stream) => {
return /** @type {Promise<Buffer[]>} */ (
new Promise((resolve, reject) => {
const chunks = /** @type {Buffer[]} */ ([])
stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)))
stream.on('error', (err) => reject(err))
stream.on('end', () => resolve(chunks))
})
)
}

// eslint-disable-next-line no-console
Expand Down

0 comments on commit e272d97

Please # to comment.