Skip to content

Writing automated smart contract tests: instructions are not clear and the code is not running #422

Description

@antontranelis

I have some confusion with running performing-complex-assertions in "Writing automated smart contract tests."

The doc say: "OpenZeppelin Test Helpers is web3.js based, thus Hardhat users should use the Truffle plugin for compatibility. However, we recommend instead using Hardhat Chai Matchers as a better supported alternative for Ethers.js."

So what should I use now to run the code below? The Truffle plugin or hardhat-chai-matchers?

using hardhat-chai-matchers results in:

An unexpected error occurred:
ReferenceError: contract is not defined
    at Object.<anonymous> (/home/fritz/workspace/learn/test/Box.test.js:20:1)

using the truffle plugin results in:

     TypeError: Box.deployed is not a function
      at Context.<anonymous> (test/Box.test.js:15:13)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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