atproto/packages/repo/tests/util.test.ts
bnewbold 7e36c48a77
small syntax lints (#1646)
* 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
2023-09-21 10:07:54 -07:00

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!')
})
})
})