MCPcopy Index your code
hub / github.com/ccxt/ccxt / testUrlencodeNested

Function testUrlencodeNested

ts/src/test/base/test.urlencodeNested.ts:6–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import ccxt from '../../../ccxt.js';
5
6function 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
30export default testUrlencodeNested;

Callers 1

baseTestsInitFunction · 0.70

Calls 2

urlencodeNestedMethod · 0.95
assertFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…