From 5f92f288c2eb928d3ca2320fe7b05ed9a25073f0 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 27 Mar 2023 12:19:33 +0530 Subject: [PATCH] fix auction tests --- test/auction.test.ts | 10 ++++++++-- test/authority.test.ts | 3 +-- test/name.test.ts | 19 +++++++++++++------ test/status.test.ts | 3 --- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/test/auction.test.ts b/test/auction.test.ts index 976f3e2..d0b41ed 100644 --- a/test/auction.test.ts +++ b/test/auction.test.ts @@ -1,5 +1,7 @@ import {cliTest,createAuthority} from './helper'; +jest.setTimeout(3 * 60 * 1000); + const args= "auction "; const quantity=25000000 const type="aphoton" @@ -15,10 +17,14 @@ describe("test auction",() => { }); 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; - 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 ()=>{ diff --git a/test/authority.test.ts b/test/authority.test.ts index a362061..42c5935 100644 --- a/test/authority.test.ts +++ b/test/authority.test.ts @@ -1,9 +1,9 @@ import {cliTest,createBond} from './helper'; const args= "authority " +const name="laconic" var bondId: string; -var name: string; describe("test authority",() => { @@ -14,7 +14,6 @@ describe("test authority",() => { it("reserve authority",async ()=>{ - name="laconic" const resp=cliTest(args+"reserve "+name); expect(resp).toBeDefined; }); diff --git a/test/name.test.ts b/test/name.test.ts index f26c070..5718ae2 100644 --- a/test/name.test.ts +++ b/test/name.test.ts @@ -1,9 +1,10 @@ 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 name: string; describe("test names",() => { @@ -13,26 +14,32 @@ describe("test names",() => { // get record id 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 ()=>{ - const resp=cliTest(args+"set "+name+" "+recordId); + const resp=cliTest(args+"set "+crn+" "+recordId); expect(resp).toBeDefined; }); it("lookup name",async ()=>{ - const resp=cliTest(args+"lookup "+ name); + const resp=cliTest(args+"lookup "+ crn); expect(resp).toBeDefined; }); it("resolve name",async ()=>{ - const resp=cliTest(args+"resolve "+name); + const resp=cliTest(args+"resolve "+crn); expect(resp).toBeDefined; }); it("delelte name",async ()=>{ - const resp=cliTest(args+"delete "+name); + const resp=cliTest(args+"delete "+crn); expect(resp).toBeDefined; }); }); \ No newline at end of file diff --git a/test/status.test.ts b/test/status.test.ts index 28d6bd9..8e769a2 100644 --- a/test/status.test.ts +++ b/test/status.test.ts @@ -2,9 +2,6 @@ import {cliTest} from './helper'; const args= "status " -var recordId: string; -var name: string; - describe("test status",() => { it("get status",async ()=>{