Add a method for get authorities and update tests #18
@ -22,9 +22,6 @@ const namingTests = () => {
|
|||||||
const mnenonic1 = Account.generateMnemonic();
|
const mnenonic1 = Account.generateMnemonic();
|
||||||
let otherAccount1: Account;
|
let otherAccount1: Account;
|
||||||
|
|
||||||
const mnenonic2 = Account.generateMnemonic();
|
|
||||||
let otherAccount2: Account;
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||||
|
|
||||||
@ -48,9 +45,6 @@ const namingTests = () => {
|
|||||||
|
|
||||||
otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
||||||
await otherAccount1.init();
|
await otherAccount1.init();
|
||||||
|
|
||||||
otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
|
|
||||||
await otherAccount2.init();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Authority tests', () => {
|
describe('Authority tests', () => {
|
||||||
@ -102,6 +96,10 @@ const namingTests = () => {
|
|||||||
|
|
||||||
test('Reserve sub-authority with different owner.', async () => {
|
test('Reserve sub-authority with different owner.', async () => {
|
||||||
// Create another account, send tx to set public key on the account.
|
// 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: '1000000000', destinationAddress: otherAccount1.address }, privateKey, fee);
|
||||||
await registry.sendCoins({ denom: DENOM, amount: '1000', destinationAddress: otherAccount2.address }, otherAccount1.getPrivateKey(), 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 () => {
|
test('List authorities by owner.', async () => {
|
||||||
const authority1 = await registry.getAuthorities(otherAccount1._address);
|
const authorities = await registry.getAuthorities(otherAccount1.address);
|
||||||
const authority2 = await registry.getAuthorities(otherAccount2._address);
|
|
||||||
|
|
||||||
expect(authority1).toBeDefined();
|
expect(authorities[0].entry.ownerAddress).toBe(otherAccount1.address);
|
||||||
expect(authority2).toBeDefined();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user