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: deep-stack/registry-sdk#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:
parent
a53e2178d2
commit
4e5f9bf9e1
@ -1,2 +1,4 @@
|
||||
PRIVATE_KEY=75f719e613d05efab06a3f1dde5250b497723b13d4afa4f8ed80145764e40cf7
|
||||
PRIVATE_KEY=
|
||||
COSMOS_CHAIN_ID=laconic_9000-1
|
||||
LACONICD_GQL_ENDPOINT=http://localhost:9473/api
|
||||
LACONICD_REST_ENDPOINT=http://127.0.0.1:26657
|
||||
|
30
README.md
30
README.md
@ -14,14 +14,18 @@ Follow these steps to run the tests:
|
||||
|
||||
- Copy [.env.example](./.env.example) file and create a `.env` file.
|
||||
|
||||
- Clone the [laconicd repo](https://github.com/cerc-io/laconicd) and change to repo directory.
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- Run the chain using `./init.sh`.
|
||||
- Clone the [laconic2d repo](https://git.vdb.to/deep-stack/laconic2d) and change to repo directory.
|
||||
|
||||
- Run the chain using `./scripts/init.sh`.
|
||||
|
||||
- Export the private key using:
|
||||
|
||||
```bash
|
||||
laconicd keys export mykey --unarmored-hex --unsafe
|
||||
laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe
|
||||
```
|
||||
|
||||
- Copy the private key and assign it to variable `PRIVATE_KEY` in the `.env` file.
|
||||
@ -34,22 +38,16 @@ Follow these steps to run the tests:
|
||||
|
||||
- Run the tests with auctions enabled
|
||||
|
||||
- Remove laconicd data from previous run
|
||||
|
||||
```bash
|
||||
rm -rf ~/.laconicd
|
||||
```
|
||||
|
||||
- In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_AUCTION_ENABLED=true ./init.sh
|
||||
TEST_AUCTION_ENABLED=true ./scripts/init.sh clean
|
||||
```
|
||||
|
||||
- Export the private key and change it in `.env` file again using:
|
||||
|
||||
```bash
|
||||
laconicd keys export mykey --unarmored-hex --unsafe
|
||||
laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe
|
||||
```
|
||||
|
||||
- Run tests:
|
||||
@ -60,22 +58,16 @@ Follow these steps to run the tests:
|
||||
|
||||
- Run the tests for record and authority expiry
|
||||
|
||||
- Remove laconicd data from previous run
|
||||
|
||||
```bash
|
||||
rm -rf ~/.laconicd
|
||||
```
|
||||
|
||||
- In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_REGISTRY_EXPIRY=true ./init.sh
|
||||
TEST_REGISTRY_EXPIRY=true ./scripts/init.sh clean
|
||||
```
|
||||
|
||||
- Export the private key and change it in `.env` file again using:
|
||||
|
||||
```bash
|
||||
laconicd keys export mykey --unarmored-hex --unsafe
|
||||
laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe
|
||||
```
|
||||
|
||||
- Run tests:
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -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]);
|
||||
}
|
||||
|
@ -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' }],
|
||||
|
Loading…
Reference in New Issue
Block a user