spot private read tests v3
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { API_ERROR_CODE } from '../src';
|
||||
|
||||
const SUCCESS_MSG_REGEX = /OK|SUCCESS|success|success\.|Request accepted|/gim;
|
||||
|
||||
export function successResponseList(successMsg: string | null = 'OK') {
|
||||
return {
|
||||
result: expect.any(Array),
|
||||
@@ -8,6 +10,15 @@ export function successResponseList(successMsg: string | null = 'OK') {
|
||||
};
|
||||
}
|
||||
|
||||
export function successResponseListV3(successMsg: string | null = 'OK') {
|
||||
return {
|
||||
result: {
|
||||
list: expect.any(Array),
|
||||
},
|
||||
...successEmptyResponseObjectV3(),
|
||||
};
|
||||
}
|
||||
|
||||
export function successResponseObject(successMsg: string | null = 'OK') {
|
||||
return {
|
||||
result: expect.any(Object),
|
||||
@@ -26,9 +37,7 @@ export function successResponseObjectV3() {
|
||||
export function successEmptyResponseObjectV3() {
|
||||
return {
|
||||
retCode: API_ERROR_CODE.SUCCESS,
|
||||
retMsg: expect.stringMatching(
|
||||
/OK|SUCCESS|success|success\.|Request accepted|/gim
|
||||
),
|
||||
retMsg: expect.stringMatching(SUCCESS_MSG_REGEX),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,6 +53,16 @@ export function errorResponseObject(
|
||||
};
|
||||
}
|
||||
|
||||
export function errorResponseObjectV3(
|
||||
result: null | any = null,
|
||||
retCode: number
|
||||
) {
|
||||
return {
|
||||
result,
|
||||
retCode: retCode,
|
||||
};
|
||||
}
|
||||
|
||||
export function notAuthenticatedError() {
|
||||
return new Error('Private endpoints require api and private keys set');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user