Skip to content

Commit

Permalink
chore: missed test account retrieval simplification in one spot (#11172)
Browse files Browse the repository at this point in the history
I merged #10949 too
quickly and missed this one.
  • Loading branch information
dbanks12 authored Jan 10, 2025
1 parent 7176a70 commit b72234e
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
import { TokenContract } from '@aztec/noir-contracts.js/Token';

import { jest } from '@jest/globals';
import { strict as assert } from 'assert';

import {
type ISnapshotManager,
Expand Down Expand Up @@ -49,20 +48,7 @@ export class TokenContractTest {
await this.snapshotManager.snapshot('3_accounts', addAccounts(3, this.logger), async ({ accountKeys }, { pxe }) => {
const accountManagers = accountKeys.map(ak => getSchnorrAccount(pxe, ak[0], ak[1], 1));
this.wallets = await Promise.all(accountManagers.map(a => a.getWallet()));

// This Map and loop ensure that this.accounts has the same order as this.wallets and this.keys
const registeredAccounts: Map<string, CompleteAddress> = new Map(
(await pxe.getRegisteredAccounts()).map(acc => [acc.address.toString(), acc]),
);
for (let i = 0; i < this.wallets.length; i++) {
const wallet = this.wallets[i];
const walletAddr = wallet.getAddress().toString();
assert(
registeredAccounts.has(walletAddr),
`Test account ${walletAddr} not registered, but it should have been`,
);
this.accounts.push(registeredAccounts.get(walletAddr)!);
}
this.accounts = accountManagers.map(a => a.getCompleteAddress());
});

await this.snapshotManager.snapshot(
Expand Down

0 comments on commit b72234e

Please sign in to comment.