import { isTaskSavedObjectNotFoundError } from './is_task_not_found_error' ; import { SavedObjectsErrorHelpers } from '../../../../../src/core/server' ; import uuid from 'uuid' ; describe ( 'isTaskSavedObjectNotFoundError' , ( ) => { test ( 'identifies SavedObjects Not Found errors' , ( ) => { const id = uuid . v4 ( ) ; expect ( `${ SavedObjectsErrorHelpers . createGenericNotFoundError ( 'task' , id ) }` . includes ( `task/${ id }` ) ) . toBe ( true ) ; const errorBySavedObjectsHelper = SavedObjectsErrorHelpers . createGenericNotFoundError ( 'task' , id ) ; expect ( isTaskSavedObjectNotFoundError ( errorBySavedObjectsHelper , id ) ) . toBe ( true ) ; } ) ; test ( 'identifies generic errors' , ( ) => { const id = uuid . v4 ( ) ; expect ( isTaskSavedObjectNotFoundError ( new Error ( `not found` ) , id ) ) . toBe ( false ) ; } ) ; } ) ;