@@ -282,17 +282,17 @@ describe('LndClient', () => {
282282
283283 describe ( 'checkLowBalance' , ( ) => {
284284 test ( 'emits lowTradingBalance on local balance is less than alert threshold of total balance ' , async ( ) => {
285- const emit = jest . fn ( ) . mockImplementation ( ) ;
285+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
286286 const totalBalance = 120 ;
287287 const localBalance = 10 ;
288288 const alertThreshold = totalBalance * 0.1 ;
289289 const remoteBalance = 110 ;
290290
291291 const currency = 'BTC' ;
292- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
292+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
293293
294- expect ( emit ) . toHaveBeenCalledTimes ( 1 ) ;
295- expect ( emit ) . toHaveBeenCalledWith ( 'lowTradingBalance' , {
294+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 1 ) ;
295+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledWith ( 'lowTradingBalance' , {
296296 totalBalance,
297297 currency,
298298 side : ChannelSide . Local ,
@@ -301,17 +301,17 @@ describe('LndClient', () => {
301301 } ) ;
302302 } ) ;
303303 test ( 'emits lowBalance on local balance is less than alert threshold of total balance ' , async ( ) => {
304- const emit = jest . fn ( ) . mockImplementation ( ) ;
304+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
305305 const totalBalance = 120 ;
306306 const localBalance = 10 ;
307307 const alertThreshold = totalBalance * 0.1 ;
308308 const remoteBalance = 110 ;
309309
310310 const currency = 'BTC' ;
311- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
311+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
312312
313- expect ( emit ) . toHaveBeenCalledTimes ( 1 ) ;
314- expect ( emit ) . toHaveBeenCalledWith ( 'lowTradingBalance' , {
313+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 1 ) ;
314+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledWith ( 'lowTradingBalance' , {
315315 totalBalance,
316316 currency,
317317 side : ChannelSide . Local ,
@@ -320,41 +320,41 @@ describe('LndClient', () => {
320320 } ) ;
321321 } ) ;
322322 test ( 'dont emit on local balance equals alert threshold of total balance ' , async ( ) => {
323- const emit = jest . fn ( ) . mockImplementation ( ) ;
323+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
324324 const totalBalance = 120 ;
325325 const localBalance = 12 ;
326326 const alertThreshold = totalBalance * 0.1 ;
327327 const remoteBalance = 110 ;
328328
329329 const currency = 'BTC' ;
330- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
330+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
331331
332- expect ( emit ) . toHaveBeenCalledTimes ( 0 ) ;
332+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 0 ) ;
333333 } ) ;
334334 test ( 'dont emit on local balance is higher than alert threshold of total balance ' , async ( ) => {
335- const emit = jest . fn ( ) . mockImplementation ( ) ;
335+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
336336 const totalBalance = 120 ;
337337 const localBalance = 12.5 ;
338338 const alertThreshold = totalBalance * 0.1 ;
339339 const remoteBalance = 110 ;
340340
341341 const currency = 'BTC' ;
342- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
342+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
343343
344- expect ( emit ) . toHaveBeenCalledTimes ( 0 ) ;
344+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 0 ) ;
345345 } ) ;
346346 test ( 'emits on remote balance is less than alert threshold of total balance ' , async ( ) => {
347- const emit = jest . fn ( ) . mockImplementation ( ) ;
347+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
348348 const totalBalance = 120 ;
349349 const localBalance = 110 ;
350350 const alertThreshold = totalBalance * 0.1 ;
351351 const remoteBalance = 10 ;
352352
353353 const currency = 'BTC' ;
354- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
354+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
355355
356- expect ( emit ) . toHaveBeenCalledTimes ( 1 ) ;
357- expect ( emit ) . toHaveBeenCalledWith ( 'lowTradingBalance' , {
356+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 1 ) ;
357+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledWith ( 'lowTradingBalance' , {
358358 totalBalance,
359359 currency,
360360 side : ChannelSide . Remote ,
@@ -363,28 +363,28 @@ describe('LndClient', () => {
363363 } ) ;
364364 } ) ;
365365 test ( 'dont emit on remote balance equals alert threshold of total balance ' , async ( ) => {
366- const emit = jest . fn ( ) . mockImplementation ( ) ;
366+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
367367 const totalBalance = 120 ;
368368 const localBalance = 110 ;
369369 const alertThreshold = totalBalance * 0.1 ;
370370 const remoteBalance = 12 ;
371371
372372 const currency = 'BTC' ;
373- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
373+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
374374
375- expect ( emit ) . toHaveBeenCalledTimes ( 0 ) ;
375+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 0 ) ;
376376 } ) ;
377377 test ( 'dont emit on remote balance is higher than alert threshold of total balance ' , async ( ) => {
378- const emit = jest . fn ( ) . mockImplementation ( ) ;
378+ lnd [ ' emit' ] = jest . fn ( ) . mockImplementation ( ) ;
379379 const totalBalance = 120 ;
380380 const localBalance = 110 ;
381381 const alertThreshold = totalBalance * 0.1 ;
382382 const remoteBalance = 12.5 ;
383383
384384 const currency = 'BTC' ;
385- lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency , emit ) ;
385+ lnd [ 'checkLowBalance' ] ( remoteBalance , localBalance , totalBalance , alertThreshold , currency ) ;
386386
387- expect ( emit ) . toHaveBeenCalledTimes ( 0 ) ;
387+ expect ( lnd [ ' emit' ] ) . toHaveBeenCalledTimes ( 0 ) ;
388388 } ) ;
389389 } ) ;
390390} ) ;
0 commit comments