From 8e25f30611ec6cd0a3116bdbce4df15c3e564b74 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 2 Aug 2024 15:40:27 +0530 Subject: [PATCH] Check for properties in returned authorities list --- src/nameservice-expiry.test.ts | 6 ++++++ src/naming.test.ts | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/nameservice-expiry.test.ts b/src/nameservice-expiry.test.ts index a8627e7..184c13a 100644 --- a/src/nameservice-expiry.test.ts +++ b/src/nameservice-expiry.test.ts @@ -61,6 +61,9 @@ const nameserviceExpiryTests = () => { test('Wait for expiry duration', (done) => { setTimeout(done, 60 * 1000); + + // Wait some more time for block to be executed + setTimeout(done, 3 * 1000); }); test('Check record expiry time', async () => { @@ -85,6 +88,9 @@ const nameserviceExpiryTests = () => { test('Wait for expiry duration', (done) => { 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 () => { diff --git a/src/naming.test.ts b/src/naming.test.ts index 2edf69f..7b1cd79 100644 --- a/src/naming.test.ts +++ b/src/naming.test.ts @@ -169,17 +169,28 @@ const namingTests = () => { }); 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)); + const expectedEntryKeys = [ + 'ownerAddress', + 'ownerPublicKey', + 'height', + 'status', + 'bondId', + 'expiryTime', + 'auction' + ]; expect(authorities.length).toEqual(4); - authorities.forEach((authority: any, index: number) => { + expectedEntryKeys.forEach(key => { authorities.forEach((authority: any) => { - expect(authority).toHaveProperty('name'); - expect(authority.entry).toHaveProperty('ownerAddress'); - expect(authority.entry).toHaveProperty('status'); + expect(authority.entry).toHaveProperty(key); }); + }); + authorities.forEach((authority: any, index: number) => { + expect(authority).toHaveProperty('name'); + expect(authority.entry).toHaveProperty('ownerAddress'); + expect(authority.entry).toHaveProperty('status'); expect(authority).toMatchObject(reservedAuthorities[index]); }); });