From c88fca7dcee5cfb08eddf10c4ca6d2afbf3e2299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=96=B0=E5=88=9A?= <719802264@qq.com> Date: Tue, 2 Feb 2021 14:58:38 +0800 Subject: [PATCH] update test case --- test/Token/vdodo.test.ts | 89 ++++++++++++++++++++++++++------------ test/utils/VDODOContext.ts | 6 +-- 2 files changed, 65 insertions(+), 30 deletions(-) diff --git a/test/Token/vdodo.test.ts b/test/Token/vdodo.test.ts index c264f09..1f210a7 100644 --- a/test/Token/vdodo.test.ts +++ b/test/Token/vdodo.test.ts @@ -72,34 +72,69 @@ describe("VDODO", () => { decimalStr("0") ); }); - it("vdodo first mint with no superior", async () => { + // it("vdodo first mint with no superior", async () => { - await ctx.VDODO.methods.mint(decimalStr("10"),"0x0000000000000000000000000000000000000000").send(ctx.sendParam(account0)) - assert.equal( - await ctx.DODO.methods.balanceOf(account0).call(), - decimalStr("990") - ); - assert.equal( - await await ctx.VDODO.methods.alpha().call(), - await ctx.alpha - ); - assert.equal( - await ctx.DODO.methods.balanceOf(ctx.VDODO.options.address).call(), - decimalStr("10") - ); - assert.equal( - await ctx.VDODO.methods.balanceOf(account0).call(), - decimalStr("0.1") - ); + // await ctx.VDODO.methods.mint(decimalStr("10"),"0x0000000000000000000000000000000000000000").send(ctx.sendParam(account0)) + // assert.equal( + // await ctx.DODO.methods.balanceOf(account0).call(), + // decimalStr("990") + // ); + // assert.equal( + // await await ctx.VDODO.methods.alpha().call(), + // await ctx.alpha + // ); + // assert.equal( + // await ctx.DODO.methods.balanceOf(ctx.VDODO.options.address).call(), + // decimalStr("10") + // ); + // assert.equal( + // await ctx.VDODO.methods.balanceOf(account0).call(), + // decimalStr("0.1") + // ); - assert.equal( - await ctx.VDODO.methods.totalSupply().call(), - decimalStr("0.1") - ); - assert.notEqual( - await ctx.VDODO.methods.lastRewardBlock().call(), - ctx.lastRewardBlock - ); - }); + // assert.equal( + // await ctx.VDODO.methods.totalSupply().call(), + // decimalStr("0.1") + // ); + // assert.notEqual( + // await ctx.VDODO.methods.lastRewardBlock().call(), + // ctx.lastRewardBlock + // ); + // }); + // it("vdodo owner can transfer", async () => { + + // await ctx.VDODO.methods.mint(decimalStr("10"),"0x0000000000000000000000000000000000000000").send(ctx.sendParam(account0)) + // assert.equal( + // await ctx.DODO.methods.balanceOf(account0).call(), + // decimalStr("990") + // ); + // assert.equal( + // await ctx.DODO.methods.balanceOf(ctx.VDODO.options.address).call(), + // decimalStr("10") + // ); + // assert.equal( + // await ctx.VDODO.methods.balanceOf(account0).call(), + // decimalStr("0.1") + // ); + // assert.equal( + // await ctx.VDODO.methods.balanceOf(account1).call(), + // decimalStr("0") + // ); + + + // await truffleAssert.reverts( + // ctx.VDODO.methods.transfer(account1,decimalStr("0.1")).send(ctx.sendParam(account0)), + // "vDODOToken: not allowed transfer" + // ) + // assert.equal( + // await ctx.VDODO.methods.balanceOf(account0).call(), + // decimalStr("0.1") + // ); + // assert.equal( + // await ctx.VDODO.methods.balanceOf(account1).call(), + // decimalStr("0") + // ); + + // }); }) }); diff --git a/test/utils/VDODOContext.ts b/test/utils/VDODOContext.ts index 4a44c0b..8c447ac 100644 --- a/test/utils/VDODOContext.ts +++ b/test/utils/VDODOContext.ts @@ -109,9 +109,9 @@ export class VDODOContext { this.lastRewardBlock = await this.VDODO.methods.lastRewardBlock().call(); console.log(log.blueText("[Init VDODO context]")); - - console.log("alpha = "+ this.alpha); - console.log("lastRewardBlock = " + this.lastRewardBlock); + + console.log("init alpha = " + this.alpha); + console.log("init lastRewardBlock = " + this.lastRewardBlock); } sendParam(sender, value = "0") {