()
| 7 | } |
| 8 | |
| 9 | function testBinaryToBase58 () { |
| 10 | |
| 11 | const exchange = new ccxt.Exchange ({ |
| 12 | 'id': 'sampleexchange', |
| 13 | }); |
| 14 | |
| 15 | assert (exchange.parseNumber (undefined) === undefined, 'GO skip trick'); |
| 16 | |
| 17 | // @SKIP_START_GO |
| 18 | // Test 1: Simple string |
| 19 | const binary1 = helperStrToBinary5 (exchange, 'hello'); |
| 20 | assert (exchange.binaryToBase58 (binary1) === 'Cn8eVZg'); |
| 21 | |
| 22 | // Test 2: String with space |
| 23 | const binary2 = helperStrToBinary5 (exchange, 'hello world'); |
| 24 | assert (exchange.binaryToBase58 (binary2) === 'StV1DL6CwTryKyV'); |
| 25 | |
| 26 | // Test 3: Short string |
| 27 | const binary3 = helperStrToBinary5 (exchange, 'test'); |
| 28 | assert (exchange.binaryToBase58 (binary3) === '3yZe7d'); |
| 29 | |
| 30 | // Test 4: Single byte |
| 31 | const binary4 = helperStrToBinary5 (exchange, 'a'); |
| 32 | assert (exchange.binaryToBase58 (binary4) === '2g'); |
| 33 | |
| 34 | // Test 5: Two bytes |
| 35 | const binary5 = helperStrToBinary5 (exchange, 'ab'); |
| 36 | assert (exchange.binaryToBase58 (binary5) === '8Qq'); |
| 37 | |
| 38 | // Test 6: Three bytes |
| 39 | const binary6 = helperStrToBinary5 (exchange, 'abc'); |
| 40 | assert (exchange.binaryToBase58 (binary6) === 'ZiCa'); |
| 41 | |
| 42 | // Test 7: JSON-like binary |
| 43 | const binary7 = helperStrToBinary5 (exchange, '{"key":"value"}'); |
| 44 | assert (exchange.binaryToBase58 (binary7) === '4SoiMiEYtTt5tPdi81Fik'); |
| 45 | // @SKIP_END_GO |
| 46 | } |
| 47 | |
| 48 | export default testBinaryToBase58; |
no test coverage detected
searching dependent graphs…