Check owner address for returned authorities

This commit is contained in:
IshaVenikar 2024-08-02 09:49:57 +05:30
parent 52cab23c70
commit a3b78fd363

View File

@ -22,9 +22,6 @@ const namingTests = () => {
const mnenonic1 = Account.generateMnemonic();
let otherAccount1: Account;
const mnenonic2 = Account.generateMnemonic();
let otherAccount2: Account;
beforeAll(async () => {
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
@ -48,9 +45,6 @@ const namingTests = () => {
otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
await otherAccount1.init();
otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
await otherAccount2.init();
});
describe('Authority tests', () => {
@ -102,6 +96,10 @@ const namingTests = () => {
test('Reserve sub-authority with different owner.', async () => {
// Create another account, send tx to set public key on the account.
const mnenonic2 = Account.generateMnemonic();
const otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
await otherAccount2.init();
await registry.sendCoins({ denom: DENOM, amount: '1000000000', destinationAddress: otherAccount1.address }, privateKey, fee);
await registry.sendCoins({ denom: DENOM, amount: '1000', destinationAddress: otherAccount2.address }, otherAccount1.getPrivateKey(), fee);
@ -133,11 +131,9 @@ const namingTests = () => {
});
test('List authorities by owner.', async () => {
const authority1 = await registry.getAuthorities(otherAccount1._address);
const authority2 = await registry.getAuthorities(otherAccount2._address);
const authorities = await registry.getAuthorities(otherAccount1.address);
expect(authority1).toBeDefined();
expect(authority2).toBeDefined();
expect(authorities[0].entry.ownerAddress).toBe(otherAccount1.address);
});
});
});