delete-me/test/auction.test.ts

48 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-03-31 18:18:31 +00:00
import {cliTest,createAuthority, getAuctionId} 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"
2023-03-31 18:18:31 +00:00
const name="laconic-auction"
2023-03-26 20:12:52 +00:00
var auctionId: string;
var filepath: string;
2023-03-24 11:32:38 +00:00
2023-03-31 18:18:31 +00:00
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;
});
2023-03-26 20:12:52 +00:00
});
2023-03-31 18:18:31 +00:00
}
2023-03-26 20:12:52 +00:00