From b76f52013bd6db3bdc21d4b7899ca6948c592730 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Fri, 31 Mar 2023 23:48:31 +0530 Subject: [PATCH] skip auction tests --- test/auction.test.ts | 60 +++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/test/auction.test.ts b/test/auction.test.ts index d0b41ed..92c12b8 100644 --- a/test/auction.test.ts +++ b/test/auction.test.ts @@ -1,39 +1,47 @@ -import {cliTest,createAuthority} from './helper'; +import {cliTest,createAuthority, getAuctionId} from './helper'; jest.setTimeout(3 * 60 * 1000); const args= "auction "; const quantity=25000000 const type="aphoton" +const name="laconic-auction" var auctionId: string; var filepath: string; -describe("test auction",() => { - beforeAll(async () => { - // get auction id - auctionId = createAuthority("laconic-auction") +if (!process.env.TEST_AUCTIONS_ENABLED) { + // Required as jest complains if file has no tests. + test('skipping auction tests', () => {}); + } else { + describe("test auction",() => { + beforeAll(async () => { + // reserve authority + createAuthority(name) + auctionId = getAuctionId(name) + }); + + it("bid commit",async ()=>{ + const resp=cliTest(args+"bid commit "+auctionId+" "+quantity+" "+type); + expect(resp).toBeDefined; + + filepath = resp.reveal_file + }); + + it("Wait for reveal phase.", (done) => { + setTimeout(done, 60 * 1000); + }); + + it("bid reveal", async ()=>{ + const resp=cliTest(args+"bid reveal "+auctionId+" "+filepath); + expect(resp).toBeDefined; + }); + + it("get auction",async ()=>{ + const resp=cliTest(args+"get "+auctionId); + expect(resp).toBeDefined; + }); }); + } - it("bid commit",async ()=>{ - const resp=cliTest(args+"bid commit "+auctionId+" "+quantity+" "+type); - expect(resp).toBeDefined; - - filepath = "."+resp.substring(resp.indexOf("/out/")) - }); - - it("Wait for reveal phase.", (done) => { - setTimeout(done, 60 * 1000); - }); - - it("bid reveal", async ()=>{ - const resp=JSON.parse(cliTest(args+"bid reveal "+auctionId+" "+filepath)); - expect(resp).toBeDefined; - }); - - it("get auction",async ()=>{ - const resp=JSON.parse(cliTest(args+"get "+auctionId)); - expect(resp).toBeDefined; - }); -}); \ No newline at end of file