delete-me/test/authority.test.ts

41 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2023-03-26 20:12:52 +00:00
import {cliTest,createBond} from './helper';
const args= "authority "
2023-04-03 11:10:32 +00:00
const name=`laconic-${Date.now()}`
2023-03-26 20:12:52 +00:00
var bondId: string;
describe("test authority",() => {
beforeAll(async () => {
// get bond id
bondId=createBond("aphoton","1000000000")
});
it("reserve authority",async ()=>{
const resp=cliTest(args+"reserve "+name);
2023-04-03 11:10:32 +00:00
expect(resp).toBeDefined();
expect(resp.success).toBeTruthy();
2023-03-26 20:12:52 +00:00
});
it("lookup authority information.",async ()=>{
const resp=cliTest(args+"whois "+ name);
2023-04-03 11:10:32 +00:00
expect(resp).toBeDefined();
expect(resp.length).toEqual(1);
expect(resp[0].status).toEqual("active")
expect(resp[0].bondId).toEqual("")
2023-03-26 20:12:52 +00:00
});
it("set authority bond",async ()=>{
2023-04-03 11:10:32 +00:00
const bondSet=cliTest(args+"bond set "+name+" "+bondId);
expect(bondSet).toBeDefined();
expect(bondSet.success).toBeTruthy();
const resp=cliTest(args+"whois "+ name);
expect(resp).toBeDefined();
expect(resp.length).toEqual(1);
expect(resp[0].status).toEqual("active")
expect(resp[0].bondId).toEqual(bondId)
2023-03-26 20:12:52 +00:00
});
});