Tests for registry-cli #32

Closed
0xmuralik wants to merge 23 commits from murali/tests into main
4 changed files with 22 additions and 13 deletions
Showing only changes of commit 5f92f288c2 - Show all commits

View File

@ -1,5 +1,7 @@
import {cliTest,createAuthority} from './helper'; import {cliTest,createAuthority} from './helper';
jest.setTimeout(3 * 60 * 1000);
const args= "auction "; const args= "auction ";
const quantity=25000000 const quantity=25000000
const type="aphoton" const type="aphoton"
@ -15,10 +17,14 @@ describe("test auction",() => {
}); });
it("bid commit",async ()=>{ it("bid commit",async ()=>{
const resp=JSON.parse(cliTest(args+"bid commit "+auctionId+" "+quantity+" "+type)); const resp=cliTest(args+"bid commit "+auctionId+" "+quantity+" "+type);
expect(resp).toBeDefined; expect(resp).toBeDefined;
filepath = resp.substring(resp.indexOf("./out")) filepath = "."+resp.substring(resp.indexOf("/out/"))
});
it("Wait for reveal phase.", (done) => {
setTimeout(done, 60 * 1000);
}); });
it("bid reveal", async ()=>{ it("bid reveal", async ()=>{

View File

@ -1,9 +1,9 @@
import {cliTest,createBond} from './helper'; import {cliTest,createBond} from './helper';
const args= "authority " const args= "authority "
const name="laconic"
var bondId: string; var bondId: string;
var name: string;
describe("test authority",() => { describe("test authority",() => {
@ -14,7 +14,6 @@ describe("test authority",() => {
it("reserve authority",async ()=>{ it("reserve authority",async ()=>{
name="laconic"
const resp=cliTest(args+"reserve "+name); const resp=cliTest(args+"reserve "+name);
expect(resp).toBeDefined; expect(resp).toBeDefined;
}); });

View File

@ -1,9 +1,10 @@
import {cliTest,createBond,createRecord} from './helper'; import {cliTest,createBond,createRecord} from './helper';
const args= "name " const args= "name ";
const name="laconic-name";
const crn=`crn://${name}/app/test`;
var recordId: string; var recordId: string;
var name: string;
describe("test names",() => { describe("test names",() => {
@ -13,26 +14,32 @@ describe("test names",() => {
// get record id // get record id
recordId=createRecord("./test/examples/watcher.yml",bondId) recordId=createRecord("./test/examples/watcher.yml",bondId)
// reserve authority
cliTest("authority reserve "+name);
// set authority bond
cliTest(args+"bond set "+name+" "+bondId);
}); });
it("set name",async ()=>{ it("set name",async ()=>{
const resp=cliTest(args+"set "+name+" "+recordId); const resp=cliTest(args+"set "+crn+" "+recordId);
expect(resp).toBeDefined; expect(resp).toBeDefined;
}); });
it("lookup name",async ()=>{ it("lookup name",async ()=>{
const resp=cliTest(args+"lookup "+ name); const resp=cliTest(args+"lookup "+ crn);
expect(resp).toBeDefined; expect(resp).toBeDefined;
}); });
it("resolve name",async ()=>{ it("resolve name",async ()=>{
const resp=cliTest(args+"resolve "+name); const resp=cliTest(args+"resolve "+crn);
expect(resp).toBeDefined; expect(resp).toBeDefined;
}); });
it("delelte name",async ()=>{ it("delelte name",async ()=>{
const resp=cliTest(args+"delete "+name); const resp=cliTest(args+"delete "+crn);
expect(resp).toBeDefined; expect(resp).toBeDefined;
}); });
}); });

View File

@ -2,9 +2,6 @@ import {cliTest} from './helper';
const args= "status " const args= "status "
var recordId: string;
var name: string;
describe("test status",() => { describe("test status",() => {
it("get status",async ()=>{ it("get status",async ()=>{