@@ -46,19 +46,29 @@ describe('RippleAPI', function() {
46
46
afterEach ( setupAPI . teardown ) ;
47
47
48
48
it ( 'preparePayment' , function ( done ) {
49
- this . api . preparePayment ( address , requests . preparePayment , instructions ,
49
+ const localInstructions = _ . defaults ( {
50
+ maxFee : '0.000012'
51
+ } , instructions ) ;
52
+ this . api . preparePayment ( address , requests . preparePayment , localInstructions ,
50
53
_ . partial ( checkResult , responses . preparePayment , done ) ) ;
51
54
} ) ;
52
55
53
56
it ( 'preparePayment with all options specified' , function ( done ) {
57
+ const localInstructions = {
58
+ maxLedgerVersion : this . api . getLedgerVersion ( ) + 100 ,
59
+ fee : '0.000012'
60
+ } ;
54
61
this . api . preparePayment ( address , requests . preparePaymentAllOptions ,
55
- instructions ,
62
+ localInstructions ,
56
63
_ . partial ( checkResult , responses . preparePaymentAllOptions , done ) ) ;
57
64
} ) ;
58
65
59
66
it ( 'preparePayment without counterparty set' , function ( done ) {
67
+ const localInstructions = _ . defaults ( {
68
+ sequence : 23
69
+ } , instructions ) ;
60
70
this . api . preparePayment ( address , requests . preparePaymentNoCounterparty ,
61
- instructions ,
71
+ localInstructions ,
62
72
_ . partial ( checkResult , responses . preparePaymentNoCounterparty , done ) ) ;
63
73
} ) ;
64
74
@@ -258,7 +268,8 @@ describe('RippleAPI', function() {
258
268
it ( 'getOrderbook - direction is correct for bids and asks' , function ( done ) {
259
269
this . api . getOrderbook ( address , orderbook , { } , ( error , data ) => {
260
270
assert ( _ . every ( data . bids , bid => bid . specification . direction === 'buy' ) ) ;
261
- assert ( _ . every ( data . asks , ask => ask . specification . direction === 'sell' ) ) ;
271
+ assert (
272
+ _ . every ( data . asks , ask => ask . specification . direction === 'sell' ) ) ;
262
273
done ( ) ;
263
274
} ) ;
264
275
} ) ;
@@ -281,21 +292,50 @@ describe('RippleAPI', function() {
281
292
} ) ;
282
293
283
294
it ( 'getPaths' , function ( done ) {
284
- const pathfind = {
285
- source : {
286
- address : address
287
- } ,
288
- destination : {
289
- address : addresses . OTHER_ACCOUNT ,
290
- amount : {
291
- currency : 'USD' ,
292
- counterparty : addresses . ISSUER ,
293
- value : '100'
294
- }
295
- }
296
- } ;
297
- this . api . getPaths ( pathfind ,
298
- _ . partial ( checkResult , responses . getPaths , done ) ) ;
295
+ this . api . getPaths ( requests . getPaths . normal ,
296
+ _ . partial ( checkResult , responses . getPaths . XrpToUsd , done ) ) ;
297
+ } ) ;
298
+
299
+ // @TODO
300
+ // need decide what to do with currencies/XRP:
301
+ // if add 'XRP' in currencies, then there will be exception in
302
+ // xrpToDrops function (called from toRippledAmount)
303
+ it ( 'getPaths USD 2 USD' , function ( done ) {
304
+ this . api . getPaths ( requests . getPaths . UsdToUsd ,
305
+ _ . partial ( checkResult , responses . getPaths . UsdToUsd , done ) ) ;
306
+ } ) ;
307
+
308
+ it ( 'getPaths XRP 2 XRP' , function ( done ) {
309
+ this . api . getPaths ( requests . getPaths . XrpToXrp ,
310
+ _ . partial ( checkResult , responses . getPaths . XrpToXrp , done ) ) ;
311
+ } ) ;
312
+
313
+ it ( 'getPaths - XRP 2 XRP - not enough' , function ( done ) {
314
+ this . api . getPaths ( requests . getPaths . XrpToXrpNotEnough , ( error ) => {
315
+ assert ( error instanceof this . api . errors . NotFoundError ) ;
316
+ done ( ) ;
317
+ } ) ;
318
+ } ) ;
319
+
320
+ it ( 'getPaths - does not accept currency' , function ( done ) {
321
+ this . api . getPaths ( requests . getPaths . NotAcceptCurrency , ( error ) => {
322
+ assert ( error instanceof this . api . errors . NotFoundError ) ;
323
+ done ( ) ;
324
+ } ) ;
325
+ } ) ;
326
+
327
+ it ( 'getPaths - no paths' , function ( done ) {
328
+ this . api . getPaths ( requests . getPaths . NoPaths , ( error ) => {
329
+ assert ( error instanceof this . api . errors . NotFoundError ) ;
330
+ done ( ) ;
331
+ } ) ;
332
+ } ) ;
333
+
334
+ it ( 'getPaths - no paths with source currencies' , function ( done ) {
335
+ this . api . getPaths ( requests . getPaths . NoPathsWithCurrencies , ( error ) => {
336
+ assert ( error instanceof this . api . errors . NotFoundError ) ;
337
+ done ( ) ;
338
+ } ) ;
299
339
} ) ;
300
340
301
341
it ( 'getLedgerVersion' , function ( ) {
0 commit comments