Files
bybit-api/test/response.util.ts
2022-09-08 13:39:07 +01:00

40 lines
798 B
TypeScript

export function successResponseList(successMsg: string | null = 'OK') {
return {
result: expect.any(Array),
ret_code: 0,
ret_msg: successMsg,
};
}
export function successResponseObject(successMsg: string | null = 'OK') {
return {
result: expect.any(Object),
ret_code: 0,
ret_msg: successMsg,
};
}
export function successUSDCResponseObject() {
return {
result: expect.any(Object),
retCode: 0,
retMsg: expect.stringMatching(/OK|SUCCESS|success|success\./gim),
};
}
export function errorResponseObject(
result: null | any = null,
ret_code: number,
ret_msg: string
) {
return {
result,
ret_code,
ret_msg,
};
}
export function notAuthenticatedError() {
return new Error('Private endpoints require api and private keys set');
}