games_app/backend/dist-test-faq/tests/walletCapabilities.test.js

54 lines
2.2 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_test_1 = require("node:test");
const strict_1 = __importDefault(require("node:assert/strict"));
const walletCapabilities_1 = require("../services/walletCapabilities");
const trc20 = {
id: 1,
code: walletCapabilities_1.USDT_TRC20_CODE,
name: 'USDT (TRC20)',
network: 'TRON',
decimals: 6,
contract_address: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
};
const bep20 = {
id: 2,
code: walletCapabilities_1.USDT_BEP20_CODE,
name: 'USDT (BEP20)',
network: 'BSC',
decimals: 18,
contract_address: '0x55d398326f99059fF775485246999027B3197955',
};
const settingsOn = {
network_usdt_trc20_deposit_enabled: true,
network_usdt_trc20_withdraw_enabled: true,
network_usdt_bep20_deposit_enabled: true,
network_usdt_bep20_withdraw_enabled: true,
};
(0, node_test_1.describe)('enrichWalletType network flags', () => {
(0, node_test_1.test)('respects per-network deposit/withdraw flags', () => {
const caps = (0, walletCapabilities_1.enrichWalletType)(bep20, {
...settingsOn,
network_usdt_bep20_deposit_enabled: false,
network_usdt_bep20_withdraw_enabled: false,
});
strict_1.default.equal(caps.depositEnabled, false);
strict_1.default.equal(caps.withdrawEnabled, false);
strict_1.default.equal(caps.predictionEnabled, false);
});
(0, node_test_1.test)('prediction stays on TRC20 only', () => {
strict_1.default.equal((0, walletCapabilities_1.enrichWalletType)(trc20, settingsOn).predictionEnabled, true);
strict_1.default.equal((0, walletCapabilities_1.enrichWalletType)(bep20, settingsOn).predictionEnabled, false);
});
(0, node_test_1.test)('TRC20 withdraw off does not affect BEP20', () => {
const caps = (0, walletCapabilities_1.enrichWalletType)(bep20, {
...settingsOn,
network_usdt_trc20_withdraw_enabled: false,
});
strict_1.default.equal(caps.withdrawEnabled, true);
});
});
//# sourceMappingURL=walletCapabilities.test.js.map