Browse Source

integration-tests: additional checks on batch transactions

Mokhtar Naamani 4 years ago
parent
commit
f5facff223

+ 0 - 4
tests/network-tests/src/Api.ts

@@ -826,10 +826,6 @@ export class Api {
     }
   }
 
-  public async expectRuntimeUpgraded(): Promise<Event> {
-    return this.waitForSystemEvent('RuntimeUpdated')
-  }
-
   // Resolves to true when proposal finalized and executed successfully
   // Resolved to false when proposal finalized and execution fails
   public waitForProposalToFinalize(id: ProposalId): Promise<[boolean, EventRecord[]]> {

+ 8 - 2
tests/network-tests/src/fixtures/workingGroupModule.ts

@@ -239,7 +239,10 @@ export class WithdrawApplicationFixture extends BaseFixture {
     this.api.treasuryTransferBalanceToAccounts(roleAccounts, withdrawApplicaitonFee)
 
     // Application withdrawal
-    await this.api.batchWithdrawActiveApplications(this.applicationIds, this.module)
+    const withdrawls = await this.api.batchWithdrawActiveApplications(this.applicationIds, this.module)
+    withdrawls.forEach((withdrawl) =>
+      this.expectDispatchSuccess(withdrawl, 'Application withdrawl should have succeedeed')
+    )
   }
 }
 
@@ -543,7 +546,10 @@ export class TerminateApplicationsFixture extends BaseFixture {
     this.api.treasuryTransferBalance(leadAccount, terminateApplicationFee.muln(this.applicationIds.length))
 
     // Terminate worker applications
-    await this.api.batchTerminateApplication(leadAccount, this.applicationIds, this.module)
+    const terminations = await this.api.batchTerminateApplication(leadAccount, this.applicationIds, this.module)
+    terminations.forEach((termination) =>
+      this.expectDispatchSuccess(termination, 'Application should have been terminated')
+    )
   }
 }
 

+ 2 - 1
tests/network-tests/src/scenarios/full.ts

@@ -29,12 +29,13 @@ const scenario = async () => {
   const provider = new WsProvider(nodeUrl)
   const api: Api = await Api.create(provider, env.TREASURY_ACCOUNT_URI || '//Alice', env.SUDO_ACCOUNT_URI || '//Alice')
 
+  api.enableTxLogs()
+
   await Promise.all([creatingMemberships(api, env), councilSetup(api, env)])
 
   // Runtime is configured for MaxActiveProposalLimit = 5
   // So we should ensure we don't exceed that number of active proposals
   // which limits the number of concurrent tests that create proposals
-  api.enableTxLogs()
   await Promise.all([
     electionParametersProposal(api, env),
     spendingProposal(api, env),