UNPKG

metaapi.cloud-sdk

Version:

SDK for MetaApi, a professional cloud forex API which includes MetaTrader REST API and MetaTrader websocket API. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). CopyFactory copy trading API included. (https://metaapi.cloud)

44 lines (43 loc) 1.9 kB
import { DeepPartial } from '../../types/util'; import type sinon from 'sinon'; import 'should'; /** * Asserts that a stub or apy called specified number of times with args matched specified ones * @param {Function} spy Sinon stub or spy * @param {Number} calls Expected number of calls * @param {Array} args Expected call arguments * @throws {AssertionError} If assertion failed */ export declare function callCountWithMatch<Spy extends sinon.SinonSpy>(spy: Spy, calls: number, ...args: DeepPartial<Parameters<Spy>>): void; /** * Asserts that a stub or apy called specified number of times with args that deep equal to specified ones * @param {Function} spy Sinon stub or spy * @param {Number} calls Expected number of calls * @param {Array} args Expected call arguments * @throws {AssertionError} If assertion failed */ export declare function callCountWithExactly<Spy extends sinon.SinonSpy>(spy: Spy, calls: number, ...args: Parameters<Spy>): void; /** * Asserts that array matches to expected one with and the lengths are equal * @param {Array} actualArray Actual array to match * @param {Array} expectedArray Expected array to match to * @throws {AssertionError} If assertion failed */ export declare function arrayMatchWithEqualLength(actualArray: any, expectedArray: any): void; /** Spy call options */ export type SpyCall<TArgs extends readonly any[]> = { /** Sinon spy */ spy: sinon.SinonSpy<TArgs>; /** Call index */ call: number; /** If specified, asserts args match */ matchArgs?: DeepPartial<TArgs>; /** Logging label. Defaults to `spy` function name, which defaults to `default` */ label?: string; }; /** * Sinon's callOrder seems to have some bug giving incorrect assertion, so this is a manual implementation * @param spyCalls spy calls * @throws assertion error */ export declare function callOrder(spyCalls: SpyCall<any>[]): void;