cleanup test infra

This commit is contained in:
2024-07-29 16:14:12 +02:00
parent 72a31ab3e2
commit c485d5c715
18 changed files with 2247 additions and 1771 deletions

18
test/random.spec.ts Normal file
View File

@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest'
import { getRandomBytes } from '../dist/index.js'
describe('Random', () => {
it('Should be able to create random values', async () => {
const buffer = await getRandomBytes(8)
expect(buffer).instanceOf(Uint8Array)
expect(buffer.byteLength).toEqual(8)
})
it('Should throw error on empty array', async () => {
await expect(() => getRandomBytes(0)).rejects.toThrowErrorMatchingSnapshot()
})
it('Should throw error on negative bytes', async () => {
await expect(() => getRandomBytes(-1)).rejects.toThrowErrorMatchingSnapshot()
})
})