import expect from '@osd/expect' ; import { DuplicateField , SavedObjectNotFound , OsdError } from './errors' ; describe ( 'errors' , ( ) => { const errors = [ new DuplicateField ( 'dupfield' ) , new SavedObjectNotFound ( 'dashboard' , '123' ) ] ; errors . forEach ( ( error ) => { const className = error . constructor . name ; it ( `${ className } has a message` , ( ) => { expect ( error . message ) . to . not . be . empty ( ) ; } ) ; it ( `${ className } has a stack trace` , ( ) => { expect ( error . stack ) . to . not . be . empty ( ) ; } ) ; it ( `${ className } is an instance of OsdError` , ( ) => { expect ( error instanceof OsdError ) . to . be ( true ) ; } ) ; } ) ; } ) ;