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

Function testRawencode

js/src/test/base/test.rawencode.js:3–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import assert from 'assert';
2import ccxt from '../../../ccxt.js';
3function testRawencode() {
4 const exchange = new ccxt.Exchange({
5 'id': 'sampleexchange',
6 });
7 // todo: add sort
8 // todo: add nulls
9 const dict2 = {
10 'a': 1,
11 'b': '+&',
12 };
13 // as key-order not preserved, expect mixed orde
14 const expected2a = 'a=1&b=+&';
15 const expected2b = 'b=+&&a=1';
16 const result2 = exchange.rawencode(dict2);
17 assert(result2 === expected2a || result2 === expected2b, 'rawencode: expected ' + expected2a + ' or ' + expected2b + ' but got ' + result2);
18 // todo: fails in python, like: 'AssertionError'> rawencode: expected a=1&b[c]=2&b[something]=+&&d[0]=1&d[1]=2 but got a=1&b={'c': 2, 'something': '+&'}&d=[1, 2]
19 //
20 // const dict2 = {
21 // 'a': 1,
22 // 'b': {
23 // 'c': 2,
24 // 'something': '+&'
25 // },
26 // 'd': [ 1, 2 ],
27 // };
28 // const expected2 = 'a=1&b[c]=2&b[something]=+&&d[0]=1&d[1]=2';
29 // assert (exchange.rawencode (dict2) === expected2, 'rawencode: expected ' + expected2 + ' but got ' + exchange.rawencode (dict2));
30}
31export default testRawencode;

Callers 1

baseTestsInitFunction · 0.70

Calls 2

rawencodeMethod · 0.95
assertFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…