import { Hash as NodeHash } from 'ox/node' import { expectTypeOf, test } from 'vp/test' import type * as CoreEngine from '../../core/Engine.js' import * as CoreHash from '../../core/Hash.js' type Slot = Awaited> test('every implemented primitive is present', () => { expectTypeOf().toEqualTypeOf< () => CoreEngine.HashState >() expectTypeOf().toEqualTypeOf< () => CoreEngine.HashState >() expectTypeOf().toEqualTypeOf< (key: Uint8Array, message: Uint8Array) => Uint8Array >() expectTypeOf().toEqualTypeOf< (input: Uint8Array) => Uint8Array >() expectTypeOf().toEqualTypeOf< (input: Uint8Array) => Uint8Array >() }) test('unsupported primitives are absent', () => { expectTypeOf().not.toHaveProperty('blake3') expectTypeOf().not.toHaveProperty('createBlake3') expectTypeOf().not.toHaveProperty('createHmacSha256') expectTypeOf().not.toHaveProperty('createKeccak256') expectTypeOf().not.toHaveProperty('keccak256') }) test('the result is the raw slot, so `Engine.install` accepts it', () => { expectTypeOf<{ Hash: Slot }>().toExtend() }) test('the Node namespace exposes the public Hash API', () => { expectTypeOf(NodeHash.blake3).toEqualTypeOf(CoreHash.blake3) expectTypeOf(NodeHash.createSha256).toEqualTypeOf(CoreHash.createSha256) expectTypeOf(NodeHash.sha256).toEqualTypeOf(CoreHash.sha256) expectTypeOf().not.toHaveProperty('create') })