Pass fixturenet account address in env
All checks were successful
Tests / cli_tests (18.x) (pull_request) Successful in 5m12s
All checks were successful
Tests / cli_tests (18.x) (pull_request) Successful in 5m12s
This commit is contained in:
parent
0221d75b86
commit
a971b10cf5
@ -1,3 +1,4 @@
|
||||
import assert from 'assert';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
describe('Test laconic CLI commands', () => {
|
||||
@ -30,6 +31,9 @@ describe('Test laconic CLI commands', () => {
|
||||
});
|
||||
|
||||
describe('laconic cns <command>', () => {
|
||||
const existingAccount = process.env.EXISTING_ACCOUNT;
|
||||
assert(existingAccount, 'EXISTING_ACCOUNT not set in env');
|
||||
|
||||
test('laconic cns status', async () => {
|
||||
const result = spawnSync('laconic', ['cns', 'status']);
|
||||
|
||||
@ -55,8 +59,8 @@ describe('Test laconic CLI commands', () => {
|
||||
|
||||
describe('laconic cns bond <command>', () => {
|
||||
const bondBalance = 1000000000;
|
||||
const bondOwner = existingAccount;
|
||||
let bondId: string;
|
||||
let bondOwner: string;
|
||||
|
||||
test('laconic cns bond create', async () => {
|
||||
const result = spawnSync('laconic', ['cns', 'bond', 'create', '--type', 'aphoton', '--quantity', bondBalance.toString(), '--gas', '200000', '--fees', '200000aphoton']);
|
||||
@ -89,13 +93,10 @@ describe('Test laconic CLI commands', () => {
|
||||
const outputObj = Array.from<any>(JSON.parse(output));
|
||||
|
||||
// Expected bond
|
||||
const expectedBond = getExpectedBond({ id: bondId, balance: bondBalance });
|
||||
const expectedBond = getExpectedBond({ id: bondId, owner: bondOwner, balance: bondBalance });
|
||||
|
||||
expect(outputObj.length).toEqual(1);
|
||||
expect(outputObj[0]).toHaveProperty('owner');
|
||||
expect(outputObj[0]).toMatchObject(expectedBond);
|
||||
|
||||
bondOwner = outputObj[0].owner;
|
||||
expect(outputObj[0]).toEqual(expectedBond);
|
||||
});
|
||||
|
||||
test('laconic cns bond list --owner <owner_address>', async () => {
|
||||
@ -142,9 +143,10 @@ describe('Test laconic CLI commands', () => {
|
||||
|
||||
// Helper methods
|
||||
|
||||
function getExpectedBond(params: { id: string, balance: number, owner?: string }): any {
|
||||
const bond: any = {
|
||||
function getExpectedBond(params: { id: string, owner: string, balance: number}): any {
|
||||
return {
|
||||
id: params.id,
|
||||
owner: params.owner,
|
||||
balance: [
|
||||
{
|
||||
type: "aphoton",
|
||||
@ -152,11 +154,4 @@ function getExpectedBond(params: { id: string, balance: number, owner?: string }
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Add owner only if passed
|
||||
if (params.owner) {
|
||||
bond.owner = params.owner;
|
||||
}
|
||||
|
||||
return bond;
|
||||
}
|
||||
|
@ -3,6 +3,9 @@
|
||||
# Get the key from laconicd
|
||||
laconicd_key=$(yes | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe)
|
||||
|
||||
# Get the fixturenet account address
|
||||
laconicd_account_address=$(docker compose exec laconicd laconicd keys list | awk '/- address:/ {print $3}')
|
||||
|
||||
# Set parameters for the test suite
|
||||
cosmos_chain_id=laconic_9000-1
|
||||
laconicd_rest_endpoint=http://127.0.0.1:1317
|
||||
@ -26,4 +29,4 @@ echo "$config" > "$config_file"
|
||||
docker compose exec laconicd sh -c "curl --retry 10 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"
|
||||
|
||||
# Run tests
|
||||
yarn test
|
||||
EXISTING_ACCOUNT=$laconicd_account_address yarn test
|
||||
|
Loading…
Reference in New Issue
Block a user