import { expect } from '../../lib/assertion/expect' ; import { Test , TestSuite } from '../../testyCore' ; @ TestSuite ( 'Expect ToThrow Test Suite' ) export class ExpectToThrowTestSuite { @ Test ( 'error to throw' ) public errorToThrow ( ) { expect . toThrow ( ( ) => { throw new Error ( 'I threw.' ) ; } ) ; } @ Test ( 'no error to throw to fail' ) public noErrorToThrowToFail ( ) { expect . toThrow ( ( ) => { expect . toThrow ( ( ) => { return ; } ) ; } ) ; } @ Test ( 'error not to throw to fail' ) public errorNotToThrowToFail ( ) { expect . toThrow ( ( ) => { expect . not . toThrow ( ( ) => { throw new Error ( 'I threw.' ) ; } ) ; } ) ; } @ Test ( 'no error not to throw' ) public noErrorNotToThrow ( ) { expect . not . toThrow ( ( ) => { return ; } ) ; } @ Test ( 'error to throw async' ) public async errorToThrowAsync ( ) { await expect . toThrowAsync ( async ( ) => { throw new Error ( 'I threw.' ) ; } ) ; } @ Test ( 'no error to throw to fail async' ) public async noErrorToThrowToFailAsync ( ) { await expect . toThrowAsync ( async ( ) => { await expect . toThrowAsync ( async ( ) => Promise . resolve ( 21 ) ) ; } ) ; } @ Test ( 'error not to throw to fail async' ) public async errorNotToThrowToFailAsync ( ) { await expect . toThrow ( ( ) => { expect . not . toThrow ( ( ) => { throw new Error ( 'I threw.' ) ; } ) ; } ) ; } @ Test ( 'no error not to throw async' ) public async noErrorNotToThrowAsync ( ) { await expect . not . toThrow ( async ( ) => Promise . resolve ( 53 ) ) ; } }