@@ -14,6 +14,7 @@ import {
1414 createAddress ,
1515 createTestChannels ,
1616 createTestTokens ,
17+ createConnectionChoices ,
1718} from '../../../testing/test-data' ;
1819import { By } from '@angular/platform-browser' ;
1920import {
@@ -29,10 +30,6 @@ import {
2930} from '../payment-dialog/payment-dialog.component' ;
3031import BigNumber from 'bignumber.js' ;
3132import { of , BehaviorSubject } from 'rxjs' ;
32- import {
33- ConnectionManagerDialogPayload ,
34- ConnectionManagerDialogComponent ,
35- } from '../connection-manager-dialog/connection-manager-dialog.component' ;
3633import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
3734import {
3835 ConfirmationDialogPayload ,
@@ -45,6 +42,11 @@ import { ChannelPollingService } from '../../services/channel-polling.service';
4542import { stub } from '../../../testing/stub' ;
4643import { BalanceWithSymbolComponent } from '../balance-with-symbol/balance-with-symbol.component' ;
4744import { TokenNetworkSelectorComponent } from '../token-network-selector/token-network-selector.component' ;
45+ import {
46+ QuickConnectDialogComponent ,
47+ QuickConnectDialogPayload ,
48+ QuickConnectDialogResult ,
49+ } from '../quick-connect-dialog/quick-connect-dialog.component' ;
4850
4951describe ( 'TokenComponent' , ( ) => {
5052 let component : TokenComponent ;
@@ -184,12 +186,12 @@ describe('TokenComponent', () => {
184186 fixture . detectChanges ( ) ;
185187
186188 const dialogSpy = spyOn ( dialog , 'open' ) . and . callThrough ( ) ;
187- const dialogResult : ConnectionManagerDialogPayload = {
189+ const dialogResult : QuickConnectDialogResult = {
188190 token : unconnectedToken ,
189- funds : new BigNumber ( 10 ) ,
191+ connectionChoices : createConnectionChoices ( ) ,
190192 } ;
191193 spyOn ( dialog , 'returns' ) . and . returnValues ( true , dialogResult ) ;
192- spyOn ( raidenService , 'connectTokenNetwork ' ) . and . returnValue (
194+ spyOn ( raidenService , 'openBatchOfChannels ' ) . and . returnValue (
193195 of ( null )
194196 ) ;
195197
@@ -201,9 +203,8 @@ describe('TokenComponent', () => {
201203 message :
202204 'Do you want to use quick connect to automatically open channels?' ,
203205 } ;
204- const connectionManagerPayload : ConnectionManagerDialogPayload = {
206+ const quickConnectPayload : QuickConnectDialogPayload = {
205207 token : undefined ,
206- funds : undefined ,
207208 } ;
208209 expect ( dialogSpy ) . toHaveBeenCalledTimes ( 2 ) ;
209210 expect ( dialogSpy . calls . first ( ) . args ) . toEqual ( [
@@ -213,9 +214,10 @@ describe('TokenComponent', () => {
213214 } ,
214215 ] ) ;
215216 expect ( dialogSpy . calls . mostRecent ( ) . args ) . toEqual ( [
216- ConnectionManagerDialogComponent ,
217+ QuickConnectDialogComponent ,
217218 {
218- data : connectionManagerPayload ,
219+ data : quickConnectPayload ,
220+ width : '400px' ,
219221 } ,
220222 ] ) ;
221223 } ) ;
@@ -306,14 +308,14 @@ describe('TokenComponent', () => {
306308 fixture . detectChanges ( ) ;
307309
308310 const dialogSpy = spyOn ( dialog , 'open' ) . and . callThrough ( ) ;
309- const dialogResult : ConnectionManagerDialogPayload = {
311+ const dialogResult : QuickConnectDialogResult = {
310312 token : unconnectedToken ,
311- funds : new BigNumber ( 10 ) ,
313+ connectionChoices : createConnectionChoices ( ) ,
312314 } ;
313315 spyOn ( dialog , 'returns' ) . and . returnValues ( true , dialogResult ) ;
314- const connectSpy = spyOn (
316+ const openBatchSpy = spyOn (
315317 raidenService ,
316- 'connectTokenNetwork '
318+ 'openBatchOfChannels '
317319 ) . and . returnValue ( of ( null ) ) ;
318320
319321 clickElement ( fixture . debugElement , '#transfer' ) ;
@@ -323,9 +325,8 @@ describe('TokenComponent', () => {
323325 title : `No open ${ unconnectedToken . symbol } channels` ,
324326 message : `Do you want to use quick connect to automatically open ${ unconnectedToken . symbol } channels?` ,
325327 } ;
326- const connectionManagerPayload : ConnectionManagerDialogPayload = {
328+ const quickConnectPayload : QuickConnectDialogPayload = {
327329 token : unconnectedToken ,
328- funds : undefined ,
329330 } ;
330331 expect ( dialogSpy ) . toHaveBeenCalledTimes ( 2 ) ;
331332 expect ( dialogSpy . calls . first ( ) . args ) . toEqual ( [
@@ -335,15 +336,16 @@ describe('TokenComponent', () => {
335336 } ,
336337 ] ) ;
337338 expect ( dialogSpy . calls . mostRecent ( ) . args ) . toEqual ( [
338- ConnectionManagerDialogComponent ,
339+ QuickConnectDialogComponent ,
339340 {
340- data : connectionManagerPayload ,
341+ data : quickConnectPayload ,
342+ width : '400px' ,
341343 } ,
342344 ] ) ;
343- expect ( connectSpy ) . toHaveBeenCalledTimes ( 1 ) ;
344- expect ( connectSpy ) . toHaveBeenCalledWith (
345- dialogResult . funds ,
346- dialogResult . token . address
345+ expect ( openBatchSpy ) . toHaveBeenCalledTimes ( 1 ) ;
346+ expect ( openBatchSpy ) . toHaveBeenCalledWith (
347+ dialogResult . token ,
348+ dialogResult . connectionChoices
347349 ) ;
348350 } ) ;
349351
@@ -366,16 +368,16 @@ describe('TokenComponent', () => {
366368
367369 const dialogSpy = spyOn ( dialog , 'open' ) . and . callThrough ( ) ;
368370 spyOn ( dialog , 'returns' ) . and . returnValues ( true , null ) ;
369- const connectSpy = spyOn (
371+ const openBatchSpy = spyOn (
370372 raidenService ,
371- 'connectTokenNetwork '
373+ 'openBatchOfChannels '
372374 ) . and . returnValue ( of ( null ) ) ;
373375
374376 clickElement ( fixture . debugElement , '#transfer' ) ;
375377 fixture . detectChanges ( ) ;
376378
377379 expect ( dialogSpy ) . toHaveBeenCalledTimes ( 2 ) ;
378- expect ( connectSpy ) . toHaveBeenCalledTimes ( 0 ) ;
380+ expect ( openBatchSpy ) . toHaveBeenCalledTimes ( 0 ) ;
379381 } ) ;
380382
381383 it ( 'should mint 0.5 tokens when token has 18 decimals' , ( ) => {
0 commit comments