Skip to content

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

@antontranelis

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions