import { assertFork , jestAssertNever } from '../../test/jest-helper' ; import { Task , UnknownError } from '../task' ; import { asUnknownError } from './as-unknown-error' ; describe ( 'asUnknownError' , ( ) => { it ( 'Should catch any error' , ( cb ) => { const task = Task . fromPromise ( Promise . reject ( 'something' ) ) ; const result = task . catch ( asUnknownError ) ; result . fork ( assertFork ( cb , err => expect ( err ) . toBeInstanceOf ( UnknownError ) ) , jestAssertNever ( cb ) ) ; } ) ; } ) ;