0

I increase time the same way as described in OpenZepplin samples in the test below:

    it("should revert claim drawing with 'Android: bad state'", async () => {
    const [owner, signer1] = await ethers.getSigners();

    let duration = time.duration.seconds(3);
    await time.increase(duration);

    await truffleAssert.reverts(
        android.claimPainting(1),
        'Android: bad state'
    );
});

And it fails with Error: Invalid JSON RPC response: "". How can i fix it? time is imported as const { time } = require("@openzeppelin/test-helpers"); + "@openzeppelin/test-helpers": "0.5.15" in package.json. I also use ethers from hardhat, don't know if this could cause the problem.

invisiblecat
  • 125
  • 1
  • 10

2 Answers2

1

You will need to execute Hardhat local node server and try again. "npx hardhat node" Hope this works on your side.

Thorblock
  • 26
  • 2
0

Install web3 and the hardhat-web3 plugin.

npm install --save-dev @nomiclabs/hardhat-web3 web3

Then add the following line to your hardhat config

import "@nomiclabs/hardhat-web3";