Skip to content

Commit

Permalink
fix: tests handling account serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hstove committed May 17, 2024
1 parent b00c618 commit a5eacef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/files/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export function generateAccountsCode(accounts: SessionAccount[]) {
return [name, rest];
})
);
return `export const accounts = ${JSON.stringify(namedAccounts)} as const;`;
// return `export const accounts = ${JSON.stringify(namedAccounts)} as const;`;
return JSON.stringify(namedAccounts);
}

// Sort accounts alphabetically by their name.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/files/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const contracts = {
${contractDefs.join(',\n')}
} as const;
${generateAccountsCode(session.accounts)}
export const accounts = ${generateAccountsCode(session.accounts)} as const;
${generateIdentifiersCode(session)}
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ test('accounts are sorted before serialization', async () => {
address: 'bbb',
},
];
const serialized = generateAccountsCode(accounts);
const serialized = JSON.parse(generateAccountsCode(accounts));
console.log('serialized', serialized);
expect(Object.keys(serialized)[0]).toEqual('wallet_1');
expect(serialized.wallet_1).toEqual({
balance: '200',
Expand Down

0 comments on commit a5eacef

Please sign in to comment.