Update check for list authorities by owner

This commit is contained in:
IshaVenikar 2024-08-02 11:52:49 +05:30
parent a3b78fd363
commit 81dbf57fc2
3 changed files with 7 additions and 12 deletions

View File

@ -392,8 +392,8 @@ export class Registry {
/** /**
* List authorities by owner. * List authorities by owner.
*/ */
async getAuthorities (owner?: string) { async getAuthorities (owner?: string, auction = false) {
return this._client.getAuthorities(owner); return this._client.getAuthorities(owner, auction);
} }
/** /**

View File

@ -127,13 +127,15 @@ const namingTests = () => {
test('List authorities.', async () => { test('List authorities.', async () => {
const authorities = await registry.getAuthorities(); const authorities = await registry.getAuthorities();
expect(authorities.length).toBeDefined(); expect(authorities.length).toEqual(4);
}); });
test('List authorities by owner.', async () => { test('List authorities by owner.', async () => {
const authorities = await registry.getAuthorities(otherAccount1.address); const authorities = await registry.getAuthorities(otherAccount1.address);
expect(authorities.length).toEqual(1);
expect(authorities[0].entry.ownerAddress).toBe(otherAccount1.address); expect(authorities[0].entry.ownerAddress).toBe(otherAccount1.address);
expect(authorities[0].entry.ownerPublicKey).toBe(otherAccount1.encodedPubkey);
}); });
}); });
}); });

View File

@ -273,7 +273,7 @@ export class RegistryClient {
/** /**
* List authorities by owner. * List authorities by owner.
*/ */
async getAuthorities (owner?: string) { async getAuthorities (owner?: string, auction = false) {
const query = `query ($owner: String) { const query = `query ($owner: String) {
getAuthorities(owner: $owner) { getAuthorities(owner: $owner) {
name name
@ -284,14 +284,7 @@ export class RegistryClient {
status status
bondId bondId
expiryTime expiryTime
auction { ${auction ? ('auction { ' + auctionFields + ' }') : ''}
id
status
ownerAddress
createTime
commitsEndTime
revealsEndTime
}
} }
} }
}`; }`;