import "chai" ; import { Err } from "../error" ; export type Spec = ( test : ( name : string , fn : ( ) => Promise < void > ) => void , assert : any ) => void ; export async function assertResolve ( assert , fn , message ? ) { let err = null ; try { await fn ( ) ; } catch ( e ) { err = e ; } assert . isNull ( err , message ) ; } export async function assertReject ( assert , fn , code , message ? ) { let err = null ; try { await fn ( ) ; } catch ( e ) { err = e ; } assert . isNotNull ( err , message ) ; assert . instanceOf ( err , Err , message ) ; assert . equal ( err ! . code , code , message ) ; }