refactor tests for new constructor pattern

This commit is contained in:
tiagosiebler
2022-09-19 23:48:35 +01:00
parent f7d59b48c1
commit d3fa937cdf
30 changed files with 160 additions and 102 deletions

View File

@@ -1,4 +1,13 @@
export interface RestClientOptions {
/** Your API key */
key?: string;
/** Your API secret */
secret?: string;
/** Set to `true` to connect to testnet. Uses the live environment by default. */
testnet?: boolean;
/** Override the max size of the request window (in ms) */
recv_window?: number;
@@ -43,7 +52,7 @@ export function serializeParams(
}
export function getRestBaseUrl(
useLivenet: boolean,
useTestnet: boolean,
restInverseOptions: RestClientOptions
): string {
const exchangeBaseUrls = {
@@ -55,10 +64,11 @@ export function getRestBaseUrl(
return restInverseOptions.baseUrl;
}
if (useLivenet === true) {
return exchangeBaseUrls.livenet;
if (useTestnet) {
return exchangeBaseUrls.testnet;
}
return exchangeBaseUrls.testnet;
return exchangeBaseUrls.livenet;
}
export function isWsPong(msg: any): boolean {