7e36c48a77
* lint: remove unused imports and variables * lint: prefix unused args with '_' * eslint: skip no-explicit-any; ignore unused _var (prefix) * eslint: explicitly mark ignores for tricky cases
22 lines
589 B
TypeScript
22 lines
589 B
TypeScript
import { dataToCborBlock, wait } from '@atproto/common'
|
|
import { writeCar } from '../src'
|
|
|
|
describe('Utils', () => {
|
|
describe('writeCar()', () => {
|
|
it('propagates errors', async () => {
|
|
const iterate = async () => {
|
|
const iter = writeCar(null, async (car) => {
|
|
await wait(1)
|
|
const block = await dataToCborBlock({ test: 1 })
|
|
await car.put(block)
|
|
throw new Error('Oops!')
|
|
})
|
|
for await (const _bytes of iter) {
|
|
// no-op
|
|
}
|
|
}
|
|
await expect(iterate).rejects.toThrow('Oops!')
|
|
})
|
|
})
|
|
})
|