delete-me/test/auction.test.ts

39 lines
962 B
TypeScript
Raw Normal View History

2023-03-26 20:12:52 +00:00
import {cliTest,createAuthority} from './helper';
2023-03-24 11:32:38 +00:00
2023-03-27 06:49:33 +00:00
jest.setTimeout(3 * 60 * 1000);
2023-03-26 20:12:52 +00:00
const args= "auction ";
const quantity=25000000
const type="aphoton"
var auctionId: string;
var filepath: string;
2023-03-24 11:32:38 +00:00
describe("test auction",() => {
2023-03-26 20:12:52 +00:00
beforeAll(async () => {
// get auction id
auctionId = createAuthority("laconic-auction")
});
2023-03-24 11:32:38 +00:00
it("bid commit",async ()=>{
2023-03-27 06:49:33 +00:00
const resp=cliTest(args+"bid commit "+auctionId+" "+quantity+" "+type);
2023-03-26 20:12:52 +00:00
expect(resp).toBeDefined;
2023-03-27 06:49:33 +00:00
filepath = "."+resp.substring(resp.indexOf("/out/"))
});
it("Wait for reveal phase.", (done) => {
setTimeout(done, 60 * 1000);
2023-03-26 20:12:52 +00:00
});
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;
2023-03-24 11:32:38 +00:00
});
});