import { type Bytes, Hash, type Hex } from 'ox' import { describe, expectTypeOf, test } from 'vp/test' describe('blake3', () => { test('default', () => { expectTypeOf(Hash.blake3('0x')).toEqualTypeOf() expectTypeOf(Hash.blake3(new Uint8Array())).toEqualTypeOf() }) test('as', () => { expectTypeOf( Hash.blake3('0x', { as: 'Bytes' }), ).toEqualTypeOf() expectTypeOf( Hash.blake3(new Uint8Array(), { as: 'Hex' }), ).toEqualTypeOf() }) }) describe('incremental', () => { test('factories', () => { expectTypeOf(Hash.createBlake3()).toEqualTypeOf() expectTypeOf(Hash.createHmac256('0x')).toEqualTypeOf() expectTypeOf(Hash.createKeccak256()).toEqualTypeOf() expectTypeOf(Hash.createRipemd160()).toEqualTypeOf() expectTypeOf(Hash.createSha256()).toEqualTypeOf() }) test('Hasher', () => { const hash = Hash.createSha256() expectTypeOf(hash.update('0x')).toEqualTypeOf() expectTypeOf(hash.update(new Uint8Array())).toEqualTypeOf() expectTypeOf(hash.clone()).toEqualTypeOf() expectTypeOf(hash.digest()).toEqualTypeOf() expectTypeOf(hash.digest({ as: 'Hex' })).toEqualTypeOf() expectTypeOf(hash.digest({ as: 'Bytes' })).toEqualTypeOf() expectTypeOf(hash.digestInto(new Uint8Array())).toEqualTypeOf() expectTypeOf(hash.destroy()).toEqualTypeOf() }) })