fix coverage

This commit is contained in:
mingda
2020-06-26 13:09:07 +08:00
parent ad111a85d8
commit 9f0642f0e0
6 changed files with 20 additions and 8 deletions

3
.gitignore vendored
View File

@@ -5,7 +5,8 @@
build/
dist/
docs/
docs/img
docs/src
node_modules/
coverage/
lint/

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@
"scripts": {
"prettier": "prettier --write **/*.sol",
"migrate": "truffle migrate",
"compile": "truffle compile",
"compile": "rm -r build && truffle compile",
"coverage": "NETWORK_ID=1002 RPC_NODE_URI=http://127.0.0.1:6545 COVERAGE=true truffle run coverage",
"test": "truffle compile && truffle test",
"test_only": "truffle test",

View File

@@ -89,7 +89,7 @@ describe("Admin", () => {
await ctx.DODO.methods.disableBaseDeposit().send(ctx.sendParam(ctx.Supervisor))
await assert.rejects(
ctx.DODO.methods.depositBase(decimalStr("10")).send(ctx.sendParam(lp1)),
/DEPOSIT_BASE_NOT_ALLOWED/
/DEPOSIT_BASE_TOKEN_NOT_ALLOWED/
)
await ctx.DODO.methods.enableBaseDeposit().send(ctx.sendParam(ctx.Deployer))
@@ -99,7 +99,7 @@ describe("Admin", () => {
await ctx.DODO.methods.disableQuoteDeposit().send(ctx.sendParam(ctx.Supervisor))
await assert.rejects(
ctx.DODO.methods.depositQuote(decimalStr("1000")).send(ctx.sendParam(lp1)),
/DEPOSIT_QUOTE_NOT_ALLOWED/
/DEPOSIT_QUOTE_TOKEN_NOT_ALLOWED/
)
await ctx.DODO.methods.enableQuoteDeposit().send(ctx.sendParam(ctx.Deployer))

View File

@@ -386,7 +386,7 @@ describe("LiquidityProvider", () => {
await assert.rejects(
ctx.DODO.methods.getWithdrawBasePenalty(decimalStr("10")).call(),
/DODO_BASE_BALANCE_NOT_ENOUGH/
/DODO_BASE_TOKEN_BALANCE_NOT_ENOUGH/
)
})
@@ -401,7 +401,7 @@ describe("LiquidityProvider", () => {
await assert.rejects(
ctx.DODO.methods.getWithdrawQuotePenalty(decimalStr("1000")).call(),
/DODO_QUOTE_BALANCE_NOT_ENOUGH/
/DODO_QUOTE_TOKEN_BALANCE_NOT_ENOUGH/
)
})
@@ -441,6 +441,17 @@ describe("LiquidityProvider", () => {
/LP_QUOTE_CAPITAL_BALANCE_NOT_ENOUGH/
)
})
it("withdraw when there is no lp", async () => {
await assert.rejects(
ctx.DODO.methods.withdrawBase(decimalStr("1")).send(ctx.sendParam(lp1)),
/NO_BASE_LP/
)
await assert.rejects(
ctx.DODO.methods.withdrawQuote(decimalStr("1")).send(ctx.sendParam(lp1)),
/NO_QUOTE_LP/
)
})
})
})

View File

@@ -60,7 +60,7 @@ describe("Trader", () => {
assert.equal(await ctx.DODO.methods._QUOTE_BALANCE_().call(), "1101418160497943759027")
})
it.only("buy when R is ABOVE ONE", async () => {
it("buy when R is ABOVE ONE", async () => {
await ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110")).send(ctx.sendParam(trader))
await ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("130")).send(ctx.sendParam(trader))
// trader balances