()
| 3 | import testSharedMethods from '../Exchange/base/test.sharedMethods.js'; |
| 4 | |
| 5 | function testToArray () { |
| 6 | |
| 7 | const exchange = new ccxt.Exchange ({ |
| 8 | 'id': 'sampleexchange', |
| 9 | }); |
| 10 | |
| 11 | const obj1 = { 'a': 1, 'b': 3, 'c': 2 }; |
| 12 | const obj2 = { 'a': 'x', 'b': 2 }; |
| 13 | const result1 = exchange.toArray (obj1); |
| 14 | const result2 = exchange.toArray (obj2); |
| 15 | |
| 16 | // we can't guarantee order of values in GO lang |
| 17 | // testSharedMethods.assertDeepEqual (exchange, undefined, 'testToArray', exchange.toArray (obj1), [ 1, 3, 2 ]); |
| 18 | // testSharedMethods.assertDeepEqual (exchange, undefined, 'testToArray', exchange.toArray (obj2), [ 'x', 2 ]); |
| 19 | // |
| 20 | assert (result1.length === 3, 'testToArray: length of result1 should be 3'); |
| 21 | assert (result2.length === 2, 'testToArray: length of result2 should be 2'); |
| 22 | assert (exchange.inArray (1, result1) && exchange.inArray (3, result1) && exchange.inArray (2, result1), 'testToArray: result1 should include 1, 3, and 2'); |
| 23 | assert (exchange.inArray ('x', result2) && exchange.inArray (2, result2), 'testToArray: result2 should include "x" and 2'); |
| 24 | } |
| 25 | |
| 26 | export default testToArray; |
no test coverage detected
searching dependent graphs…