import * as _ from "jsonschema" ; import { chance } from "_/helpers" ; param result return function mockValidate ( result ) { return spyOn ( _ , "validate" ) . and . returnValue ( result as _ . ValidatorResult ) ; } return export function mockValidateWithSuccess ( ) { return mockValidate ( { errors : [ ] , valid : true } ) ; } return export function mockValidateWithError ( ) { return mockValidate ( { errors : [ { path : [ chance . string ( ) ] , property : chance . string ( ) , message : chance . string ( ) , schema : chance . string ( ) , instance : chance . string ( ) , name : chance . string ( ) , argument : chance . string ( ) , stack : chance . string ( ) } ] , valid : false } ) ; }