forked from cerc-io/registry-sdk
Expect null if bond or authority is not found (#6)
Part of https://www.notion.so/Create-laconic-registry-SDK-d3a636d4aba44f7cbba3bd99b7146811 Co-authored-by: neeraj <neeraj.rtly@gmail.com> Reviewed-on: #6 Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to> Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
This commit is contained in:
+1
-3
@@ -88,9 +88,7 @@ const bondTests = () => {
|
||||
test('Cancel bond.', async () => {
|
||||
await registry.cancelBond({ id: bond1.id }, privateKey, fee);
|
||||
const [bond] = await registry.getBondsByIds([bond1.id]);
|
||||
expect(bond.id).toBe('');
|
||||
expect(bond.owner).toBe('');
|
||||
expect(bond.balance).toHaveLength(0);
|
||||
expect(bond).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+1
-4
@@ -69,10 +69,7 @@ const namingTests = () => {
|
||||
|
||||
test('Lookup non existing authority', async () => {
|
||||
const [record] = await registry.lookupAuthorities(['does-not-exist']);
|
||||
|
||||
expect(record.ownerAddress).toBe('');
|
||||
expect(record.ownerPublicKey).toBe('');
|
||||
expect(Number(record.height)).toBe(0);
|
||||
expect(record).toBe(null);
|
||||
});
|
||||
|
||||
test('Reserve already reserved authority', async () => {
|
||||
|
||||
@@ -105,7 +105,7 @@ export class RegistryClient {
|
||||
*/
|
||||
static async getResult (query: any, key: string, modifier?: (rows: any[]) => {}) {
|
||||
const result = await query;
|
||||
if (result && result[key] && result[key].length && result[key][0] !== null) {
|
||||
if (result && result[key]) {
|
||||
if (modifier) {
|
||||
return modifier(result[key]);
|
||||
}
|
||||
|
||||
+1
-2
@@ -36,8 +36,7 @@ describe('Querying', () => {
|
||||
expect(registry.chainID).toBe(chainId);
|
||||
});
|
||||
|
||||
// TODO: Check get status error
|
||||
xtest('Get status.', async () => {
|
||||
test('Get status.', async () => {
|
||||
const status = await registry.getStatus();
|
||||
expect(status).toBeDefined();
|
||||
expect(status.version).toBeDefined();
|
||||
|
||||
@@ -26,7 +26,7 @@ export const getConfig = () => {
|
||||
return {
|
||||
chainId: process.env.COSMOS_CHAIN_ID || DEFAULT_CHAIN_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
restEndpoint: process.env.LACONICD_REST_ENDPOINT || 'http://localhost:1317',
|
||||
restEndpoint: process.env.LACONICD_REST_ENDPOINT || 'http://localhost:26657',
|
||||
gqlEndpoint: process.env.LACONICD_GQL_ENDPOINT || 'http://localhost:9473/api',
|
||||
fee: {
|
||||
amount: [{ denom: 'photon', amount: '40' }],
|
||||
|
||||
Reference in New Issue
Block a user