Add a method for get authorities and update tests #18
@ -61,6 +61,9 @@ const nameserviceExpiryTests = () => {
|
|||||||
|
|
||||||
test('Wait for expiry duration', (done) => {
|
test('Wait for expiry duration', (done) => {
|
||||||
setTimeout(done, 60 * 1000);
|
setTimeout(done, 60 * 1000);
|
||||||
|
|
||||||
|
// Wait some more time for block to be executed
|
||||||
|
setTimeout(done, 3 * 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Check record expiry time', async () => {
|
test('Check record expiry time', async () => {
|
||||||
@ -85,6 +88,9 @@ const nameserviceExpiryTests = () => {
|
|||||||
|
|
||||||
test('Wait for expiry duration', (done) => {
|
test('Wait for expiry duration', (done) => {
|
||||||
setTimeout(done, 60 * 1000);
|
setTimeout(done, 60 * 1000);
|
||||||
|
|
||||||
|
// Wait some more time for block to be executed
|
||||||
|
setTimeout(done, 3 * 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Check record deleted without bond balance', async () => {
|
test('Check record deleted without bond balance', async () => {
|
||||||
|
@ -31,7 +31,7 @@ const namingTests = () => {
|
|||||||
};
|
};
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
let cosmosWallet: CosmosAccount;
|
let account: CosmosAccount;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||||
@ -54,9 +54,8 @@ const namingTests = () => {
|
|||||||
|
|
||||||
watcherId = result.id;
|
watcherId = result.id;
|
||||||
|
|
||||||
const account_pk = new Account(Buffer.from(privateKey, 'hex'));
|
const accountWallet = await DirectSecp256k1Wallet.fromKey(Buffer.from(privateKey, 'hex'), 'laconic');
|
||||||
const account = await DirectSecp256k1Wallet.fromKey(account_pk._privateKey, 'laconic');
|
[account] = await accountWallet.getAccounts();
|
||||||
[cosmosWallet] = await account.getAccounts();
|
|
||||||
|
|
||||||
const mnenonic1 = Account.generateMnemonic();
|
const mnenonic1 = Account.generateMnemonic();
|
||||||
otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
otherAccount1 = await Account.generateFromMnemonic(mnenonic1);
|
||||||
@ -70,7 +69,7 @@ const namingTests = () => {
|
|||||||
reservedAuthorities.push({
|
reservedAuthorities.push({
|
||||||
name: authorityName,
|
name: authorityName,
|
||||||
entry: {
|
entry: {
|
||||||
ownerAddress: cosmosWallet.address,
|
ownerAddress: account.address,
|
||||||
status: 'active'
|
status: 'active'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -88,7 +87,7 @@ const namingTests = () => {
|
|||||||
reservedAuthorities.push({
|
reservedAuthorities.push({
|
||||||
name: authorityName,
|
name: authorityName,
|
||||||
entry: {
|
entry: {
|
||||||
ownerAddress: cosmosWallet.address,
|
ownerAddress: account.address,
|
||||||
status: 'active'
|
status: 'active'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -119,7 +118,7 @@ const namingTests = () => {
|
|||||||
reservedAuthorities.push({
|
reservedAuthorities.push({
|
||||||
name: subAuthority,
|
name: subAuthority,
|
||||||
entry: {
|
entry: {
|
||||||
ownerAddress: cosmosWallet.address,
|
ownerAddress: account.address,
|
||||||
status: 'active'
|
status: 'active'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -169,17 +168,28 @@ const namingTests = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('List authorities.', async () => {
|
test('List authorities.', async () => {
|
||||||
const authorities = await registry.getAuthorities();
|
const authorities = await registry.getAuthorities(undefined, true);
|
||||||
|
|
||||||
reservedAuthorities.sort((a, b) => a.name.localeCompare(b.name));
|
reservedAuthorities.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
const expectedEntryKeys = [
|
||||||
|
'ownerAddress',
|
||||||
|
'ownerPublicKey',
|
||||||
|
'height',
|
||||||
|
'status',
|
||||||
|
'bondId',
|
||||||
|
'expiryTime',
|
||||||
|
'auction'
|
||||||
|
];
|
||||||
|
|
||||||
expect(authorities.length).toEqual(4);
|
expect(authorities.length).toEqual(4);
|
||||||
authorities.forEach((authority: any, index: number) => {
|
expectedEntryKeys.forEach(key => {
|
||||||
authorities.forEach((authority: any) => {
|
authorities.forEach((authority: any) => {
|
||||||
|
expect(authority.entry).toHaveProperty(key);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
authorities.forEach((authority: any, index: number) => {
|
||||||
expect(authority).toHaveProperty('name');
|
expect(authority).toHaveProperty('name');
|
||||||
expect(authority.entry).toHaveProperty('ownerAddress');
|
expect(authority.entry).toHaveProperty('ownerAddress');
|
||||||
expect(authority.entry).toHaveProperty('status');
|
expect(authority.entry).toHaveProperty('status');
|
||||||
});
|
|
||||||
expect(authority).toMatchObject(reservedAuthorities[index]);
|
expect(authority).toMatchObject(reservedAuthorities[index]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -25,9 +25,8 @@ const onboardingEnabledTests = () => {
|
|||||||
const mnemonic = Account.generateMnemonic();
|
const mnemonic = Account.generateMnemonic();
|
||||||
ethWallet = Wallet.fromMnemonic(mnemonic);
|
ethWallet = Wallet.fromMnemonic(mnemonic);
|
||||||
|
|
||||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
const accountWallet = await DirectSecp256k1Wallet.fromKey(Buffer.from(privateKey, 'hex'), 'laconic');
|
||||||
const cosmosAccount = await DirectSecp256k1Wallet.fromKey(account._privateKey, 'laconic');
|
[cosmosWallet] = await accountWallet.getAccounts();
|
||||||
[cosmosWallet] = await cosmosAccount.getAccounts();
|
|
||||||
|
|
||||||
expectedParticipants = [
|
expectedParticipants = [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user