Skip to content

withdraw can't pass the test #4

@Bouqute

Description

@Bouqute

the withdraw can't pass the test,

My code like this

describe("Withdrawing",()=>{
let balanceBefore;

beforeEach(async()=>{
  // list a item
  transaction = await dappazon.connect(deployer).list(
    ID,
    NAME,
    CATEGORY,
    IMAGE,
    COST,
    RATING,
    STOCK
  )
  await transaction.wait()

  // buy an item
  transaction = await dappazon.connect(buyer).buy(ID,{value:COST})
  await transaction.wait()

  // get deployer balance  before
  balanceBefore = await ethers.provider.getBalance(deployer.address);

  // withdraw
  transaction = await dappazon.connect(deployer).withdraw();
  await transaction.wait()  

})



it("Update the owner balance", async()=>{
  const balanceAfter = await ethers.provider.getBalance(buyer.address);
  expect(balanceAfter).to.be.greaterThan(balanceBefore)
})


it("Update the contract balance", async()=>{
  const result = await ethers.provider.getBalance(deployer.address);
  expect(result).to.equal(0)
})

})

i get the err, the err message like

AssertionError: expected 9994998096167587283777 to be above 9999982111701002581047. The numerical values of the given "ethers.BigNumber" and "ethers.BigNumber" inputs were compared, and they differed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions