Add CLI tests and setup CI #53

Merged
ashwin merged 23 commits from deep-stack/laconic-registry-cli:pm-add-tests into main 2024-01-29 04:46:32 +00:00
Showing only changes of commit 7ac169d822 - Show all commits

View File

@ -32,6 +32,8 @@ describe('Test laconic CLI commands', () => {
expect(errorOutput).toContain('Commands:');
});
// TODO: Add tests for CNS commands with all available flags
describe('laconic CNS commands', () => {
const initialAccountBalance = Number('100000000000000000000000000');
const testAccount = process.env.TEST_ACCOUNT;
@ -60,7 +62,7 @@ describe('Test laconic CLI commands', () => {
const bondOwner = testAccount;
let bondId: string;
test('laconic cns bond create', async () => {
test('laconic cns bond create --type <type> --quantity <quantity>', async () => {
const result = spawnSync('laconic', ['cns', 'bond', 'create', '--type', TOKEN_TYPE, '--quantity', bondBalance.toString(), '--gas', '200000', '--fees', `200000${TOKEN_TYPE}`]);
const outputObj = checkResultAndRetrieveOutput(result);
@ -102,6 +104,18 @@ describe('Test laconic CLI commands', () => {
expect(outputObj.length).toEqual(1);
expect(outputObj[0]).toEqual(expectedBond);
});
test('laconic cns bond refill --id <bond_id> --type <type> --quantity <quantity>', async () => {
// TODO
});
test('laconic cns bond withdraw --id <bond_id> --type <type> --quantity <quantity>', async () => {
// TODO
});
test('laconic cns bond cancel --id <bond_id>', async () => {
// TODO
});
});
describe('Account and tokens operations', () => {
@ -187,9 +201,23 @@ describe('Test laconic CLI commands', () => {
expect(outputObj.length).toEqual(1);
expect(outputObj[0]).toMatchObject(expectedRecord);
});
describe('Bond records operations', () => {
test('laconic cns bond associate --id <record_id> --bond-id <bond_id>', async () => {
// TODO
});
test('laconic cns bond dissociate --id <record_id>', async () => {
// TODO
});
test('laconic cns bond records reassociate --old-bond-id <old_bond_id> --new-bond-id <new_bond_id>', async () => {
// TODO
});
});
});
describe('Name authority operations', () => {
describe('Name authority operations (pre auction)', () => {
const authorityName = 'laconic';
test('laconic cns authority reserve <authority_name>', async () => {
@ -213,6 +241,52 @@ describe('Test laconic CLI commands', () => {
expect(outputObj[0].height).toBeGreaterThan(0);
});
});
describe('Auction operations', () => {
test('laconic cns auction get <auction_id>', async () => {
// TODO
});
test('laconic cns auction bid commit <auction_id> <quantity> <type>', async () => {
// TODO
});
test('laconic cns auction bid reveal <auction_id> <file-path>', async () => {
// TODO
});
});
describe('Name authority operations (post auction)', () => {
test('laconic cns authority bond set laconic <bond_id>', async () => {
// TODO
});
test('laconic cns authority reserve <sub_authority> (same owner)', async () => {
// TODO
});
test('laconic cns authority reserve <sub_authority> --owner <owner_address> (different owner)', async () => {
// TODO
});
});
describe('Name operations', () => {
test('laconic cns name set <name> <record_id>', async () => {
// TODO
});
test('laconic cns name lookup <name>', async () => {
// TODO
});
test('laconic cns name resolve <name>', async () => {
// TODO
});
test('laconic cns name delete <name>', async () => {
// TODO
});
});
});
});