1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License") 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16export class ArgumentMatchers { 17 static any; 18 static anyString; 19 static anyBoolean; 20 static anyNumber; 21 static anyObj; 22 static anyFunction; 23 static matchRegexs(Regex: RegExp): void 24} 25 26declare interface when { 27 afterReturn(value: any): any 28 afterReturnNothing(): undefined 29 afterAction(action: any): any 30 afterThrow(e_msg: string): string 31 (argMatchers?: any): when; 32} 33 34export const when: when; 35 36export interface VerificationMode { 37 times(count: Number): void 38 never(): void 39 once(): void 40 atLeast(count: Number): void 41 atMost(count: Number): void 42} 43 44export class MockKit { 45 constructor() 46 mockFunc(obj: Object, func: Function): Function 47 mockObject(obj: Object): Object 48 verify(methodName: String, argsArray: Array<any>): VerificationMode 49 ignoreMock(obj: Object, func: Function): void 50 clear(obj: Object): void 51 clearAll(): void 52} 53 54export declare function MockSetup( 55 target: Object, 56 propertyName: string | Symbol, 57 descriptor: TypedPropertyDescriptor<() => void> 58): void;