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