Add test for command to fetch account details
All checks were successful
Tests / cli_tests (18.x) (pull_request) Successful in 3m49s
All checks were successful
Tests / cli_tests (18.x) (pull_request) Successful in 3m49s
This commit is contained in:
parent
a971b10cf5
commit
75493f05e3
@ -31,6 +31,7 @@ describe('Test laconic CLI commands', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('laconic cns <command>', () => {
|
describe('laconic cns <command>', () => {
|
||||||
|
const initialAccountBalance = Number('100000000000000000000000000');
|
||||||
const existingAccount = process.env.EXISTING_ACCOUNT;
|
const existingAccount = process.env.EXISTING_ACCOUNT;
|
||||||
assert(existingAccount, 'EXISTING_ACCOUNT not set in env');
|
assert(existingAccount, 'EXISTING_ACCOUNT not set in env');
|
||||||
|
|
||||||
@ -137,6 +138,38 @@ describe('Test laconic CLI commands', () => {
|
|||||||
expect(outputObj[0]).toEqual(expectedBond);
|
expect(outputObj[0]).toEqual(expectedBond);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('laconic cns account <command>', () => {
|
||||||
|
test('laconic cns account get --address <account_address>', async () => {
|
||||||
|
const result = spawnSync('laconic', ['cns', 'account', 'get', '--address', existingAccount]);
|
||||||
|
|
||||||
|
const output = result.stdout.toString().trim();
|
||||||
|
const errorOutput = result.stderr.toString().trim();
|
||||||
|
|
||||||
|
expect(errorOutput).toBe('');
|
||||||
|
expect(result.status).toBe(0);
|
||||||
|
|
||||||
|
expect(output.length).toBeGreaterThan(0);
|
||||||
|
const outputObj = Array.from<any>(JSON.parse(output));
|
||||||
|
|
||||||
|
// Expected account
|
||||||
|
const expectedAccount = {
|
||||||
|
address: existingAccount,
|
||||||
|
number: 0,
|
||||||
|
sequence: 2,
|
||||||
|
balance: [
|
||||||
|
{
|
||||||
|
type: "aphoton"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(outputObj.length).toEqual(1);
|
||||||
|
expect(outputObj[0]).toMatchObject(expectedAccount);
|
||||||
|
expect(Number(outputObj[0].balance[0].quantity)).toBeGreaterThan(0);
|
||||||
|
expect(Number(outputObj[0].balance[0].quantity)).toBeLessThan(initialAccountBalance);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user