Expect null if bond or authority is not found #6

Merged
nabarun merged 2 commits from nv-handle-error into main 2024-03-12 08:40:47 +00:00
4 changed files with 4 additions and 10 deletions
Showing only changes of commit c8d4783577 - Show all commits

View File

@ -88,9 +88,7 @@ const bondTests = () => {
test('Cancel bond.', async () => { test('Cancel bond.', async () => {
await registry.cancelBond({ id: bond1.id }, privateKey, fee); await registry.cancelBond({ id: bond1.id }, privateKey, fee);
const [bond] = await registry.getBondsByIds([bond1.id]); const [bond] = await registry.getBondsByIds([bond1.id]);
expect(bond.id).toBe(''); expect(bond).toBe(null);
expect(bond.owner).toBe('');
expect(bond.balance).toHaveLength(0);
}); });
}); });

View File

@ -69,10 +69,7 @@ const namingTests = () => {
test('Lookup non existing authority', async () => { test('Lookup non existing authority', async () => {
const [record] = await registry.lookupAuthorities(['does-not-exist']); const [record] = await registry.lookupAuthorities(['does-not-exist']);
expect(record).toBe(null);
expect(record.ownerAddress).toBe('');
expect(record.ownerPublicKey).toBe('');
expect(Number(record.height)).toBe(0);
}); });
test('Reserve already reserved authority', async () => { test('Reserve already reserved authority', async () => {

View File

@ -105,7 +105,7 @@ export class RegistryClient {
*/ */
static async getResult (query: any, key: string, modifier?: (rows: any[]) => {}) { static async getResult (query: any, key: string, modifier?: (rows: any[]) => {}) {
const result = await query; const result = await query;
if (result && result[key] && result[key].length && result[key][0] !== null) { if (result && result[key]) {
if (modifier) { if (modifier) {
return modifier(result[key]); return modifier(result[key]);
} }

View File

@ -36,8 +36,7 @@ describe('Querying', () => {
expect(registry.chainID).toBe(chainId); expect(registry.chainID).toBe(chainId);
}); });
// TODO: Check get status error test('Get status.', async () => {
xtest('Get status.', async () => {
const status = await registry.getStatus(); const status = await registry.getStatus();
expect(status).toBeDefined(); expect(status).toBeDefined();
expect(status.version).toBeDefined(); expect(status.version).toBeDefined();