Skip to content

Commit 91e63e0

Browse files
authored
Merge pull request #85 from AztecProtocol/jz/fix-test-account-generation
Fix: Regenerate random accounts before each test
2 parents 44d540f + 8784972 commit 91e63e0

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/test/e2e/accounts.test.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ describe("Accounts", () => {
5252
const deployedSponseredFPC = await getDeployedSponsoredFPCAddress(pxe);
5353
sponsoredPaymentMethod = new SponsoredFeePaymentMethod(deployedSponseredFPC);
5454

55-
// generate random accounts
56-
randomAccountManagers = await Promise.all(
57-
(await generateSchnorrAccounts(2)).map(
58-
a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)
59-
)
60-
);
61-
// get corresponding wallets
62-
randomWallets = await Promise.all(randomAccountManagers.map(am => am.getWallet()));
63-
// get corresponding addresses
64-
randomAddresses = await Promise.all(randomWallets.map(async w => (await w.getCompleteAddress()).address));
6555

6656
// create default ethereum clients
6757
const nodeInfo = await pxe.getNodeInfo();
@@ -81,6 +71,19 @@ describe("Accounts", () => {
8171

8272
})
8373

74+
beforeEach(async () => {
75+
// generate random accounts
76+
randomAccountManagers = await Promise.all(
77+
(await generateSchnorrAccounts(2)).map(
78+
a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)
79+
)
80+
);
81+
// get corresponding wallets
82+
randomWallets = await Promise.all(randomAccountManagers.map(am => am.getWallet()));
83+
// get corresponding addresses
84+
randomAddresses = await Promise.all(randomWallets.map(async w => (await w.getCompleteAddress()).address));
85+
})
86+
8487
afterAll(async () => {
8588
if (!skipSandbox) {
8689
sandboxInstance!.kill('SIGINT');
@@ -119,6 +122,10 @@ describe("Accounts", () => {
119122

120123
});
121124

125+
it("Deploys first unfunded account from first funded account", async () => {
126+
const tx_acc = await randomAccountManagers[0].deploy({ deployWallet: wallets[0] });
127+
});
128+
122129
it("Sponsored contract deployment", async () => {
123130
const salt = Fr.random();
124131
const VotingContractArtifact = EasyPrivateVotingContractArtifact

0 commit comments

Comments
 (0)