@@ -2,6 +2,7 @@ import * as assert from "assert";
22import { startNockRec , testingApiClient } from "./helpers/integrationTestsHelpers" ;
33import { RecipientFactory } from "./factories/RecipientFactory" ;
44import { RecipientAccountFactory } from "./factories/RecipientAccountFactory" ;
5+ import { RecipientAccount } from "../../lib" ;
56
67let recipientFactory : RecipientFactory ;
78let recipientAccountFactory : RecipientAccountFactory ;
@@ -33,7 +34,7 @@ describe("RecipientAccount", () => {
3334
3435 const primaryAccount = await testingApiClient . recipientAccount . find ( recipient . id , account . id ) ;
3536 const accountList = await testingApiClient . recipientAccount . all ( recipient . id ) ;
36- const result = await testingApiClient . recipientAccount . remove ( recipient . id , account . id ) ;
37+ const deleteResult = await testingApiClient . recipientAccount . remove ( recipient . id , account . id ) ;
3738 const accountList2 = await testingApiClient . recipientAccount . all ( recipient . id ) ;
3839
3940 nockDone ( ) ;
@@ -43,12 +44,18 @@ describe("RecipientAccount", () => {
4344 assert . ok ( account2 ) ;
4445 assert . ok ( account2 . primary ) ;
4546
47+ assert . strictEqual ( account . constructor , RecipientAccount ) ;
48+ assert . strictEqual ( account2 . constructor , RecipientAccount ) ;
4649 assert . strictEqual ( account . iban , primaryAccount . iban ) ;
4750
4851 assert . strictEqual ( accountList . length , 2 ) ;
49- assert . strictEqual ( accountList [ 0 ] . currency , "EUR" ) ;
52+ assert . strictEqual ( accountList [ 0 ] . constructor , RecipientAccount ) ;
53+ assert . strictEqual ( accountList [ 1 ] . constructor , RecipientAccount ) ;
5054
51- assert . strictEqual ( true , result ) ;
55+ assert . strictEqual ( accountList2 . length , 1 ) ;
56+ assert . strictEqual ( accountList2 [ 0 ] . id , account2 . id ) ;
57+
58+ assert . strictEqual ( true , deleteResult ) ;
5259
5360 assert . strictEqual ( accountList2 . length , 1 ) ;
5461 assert . ok ( accountList2 [ 0 ] . primary ) ;
@@ -58,30 +65,31 @@ describe("RecipientAccount", () => {
5865 const nockDone = await startNockRec ( 'recipient-account-update.json' ) ;
5966
6067 const recipient = await recipientFactory . createResource ( ) ;
61- const dummyIban = "DE89 3704 0044 0532 0130 00" ;
68+ const iban = "DE89 3704 0044 0532 0130 00" ;
6269 const account = await recipientAccountFactory . createResource ( {
6370 recipient : { id : recipient . id } ,
6471 type : "bank-transfer" ,
6572 currency : "EUR" ,
66- iban : dummyIban ,
73+ iban : iban ,
6774 } ) ;
68- const otherDummyIban = "DE91 1000 0000 0123 4567 89" ;
69- const account2 = await testingApiClient . recipientAccount . update ( recipient . id , account . id , {
70- iban : otherDummyIban ,
75+ const otherIban = "DE91 1000 0000 0123 4567 89" ;
76+ const updatedAccount = await testingApiClient . recipientAccount . update ( recipient . id , account . id , {
77+ iban : otherIban ,
7178 } ) ;
7279
7380 const accountList = await testingApiClient . recipientAccount . all ( recipient . id ) ;
7481
7582 nockDone ( ) ;
7683
7784 assert . ok ( account ) ;
78- assert . ok ( account2 ) ;
79- assert . strictEqual ( account . id , account2 . id ) ;
80- assert . ok ( account2 . iban && account2 . iban . includes ( "**89" ) ) ;
85+ assert . ok ( updatedAccount ) ;
86+ assert . strictEqual ( account . constructor , RecipientAccount ) ;
87+ assert . strictEqual ( updatedAccount . constructor , RecipientAccount ) ;
88+ assert . ok ( updatedAccount . iban && updatedAccount . iban . includes ( "**89" ) ) ;
8189
8290 assert . ok ( ( accountList as any ) [ 0 ] . iban . includes ( "**89" ) ) ;
8391 assert . strictEqual ( accountList . length , 1 ) ;
84- assert . strictEqual ( accountList [ 0 ] . id , account2 . id ) ;
92+ assert . strictEqual ( accountList [ 0 ] . id , updatedAccount . id ) ;
8593 } ) ;
8694
8795 it ( "deletes account" , async ( ) => {
0 commit comments