Browse Source

tests: correctly handle error case in BuyMembershipWithInsufficienFundsFixture

Mokhtar Naamani 3 years ago
parent
commit
c4e4bd947f
1 changed files with 6 additions and 2 deletions
  1. 6 2
      tests/network-tests/src/fixtures/membershipModule.ts

+ 6 - 2
tests/network-tests/src/fixtures/membershipModule.ts

@@ -63,13 +63,17 @@ export class BuyMembershipWithInsufficienFundsFixture extends BaseFixture {
   }
 
   async execute(): Promise<void> {
+    let memberId
     try {
-      await this.api.getMemberId(this.account)
-      assert(false, 'Account must not be associated with a member')
+      memberId = await this.api.getMemberId(this.account)
     } catch (err) {
       // member id not found
     }
 
+    if (memberId) {
+      throw new Error('Account must not be associated with a member')
+    }
+
     // Fee estimation and transfer
     const membershipFee: BN = await this.api.getMembershipFee(this.paidTerms)
     const membershipTransactionFee: BN = this.api.estimateBuyMembershipFee(