()
| 1 | import assert from 'assert'; |
| 2 | import ccxt from '../../../ccxt.js'; |
| 3 | function testUrlencodeNested() { |
| 4 | const exchange = new ccxt.Exchange({ |
| 5 | 'id': 'sampleexchange', |
| 6 | }); |
| 7 | // todo: add nulls |
| 8 | // todo: add key sort (for different langs) |
| 9 | const dict2 = { |
| 10 | 'b': { |
| 11 | 'c': 2, |
| 12 | 'target': '+&' |
| 13 | }, |
| 14 | 'd': [1, 2], |
| 15 | }; |
| 16 | const expected2a = 'b[c]=2&b[target]=%2B%26&d[0]=1&d[1]=2'; |
| 17 | const expected2c = 'b[target]=%2B%26&b[c]=2&d[0]=1&d[1]=2'; |
| 18 | const expected2b = 'd[0]=1&d[1]=2&b[c]=2&b[target]=%2B%26'; |
| 19 | const expected2d = 'd[0]=1&d[1]=2&b[target]=%2B%26&b[c]=2'; |
| 20 | const result2 = exchange.urlencodeNested(dict2); |
| 21 | assert(result2 === expected2a || result2 === expected2b || result2 === expected2c || result2 === expected2d, 'urlencodeNested: expected ' + expected2a + ' or ' + expected2b + ' or ' + expected2c + ' or ' + expected2d + ' but got ' + result2); |
| 22 | } |
| 23 | export default testUrlencodeNested; |
no test coverage detected
searching dependent graphs…