1

I have a stupid smart contract like this:

pragma solidity ^0.4.24;

contract ProdottoFactory  {

    function foo() view returns(string nome){
        return "foo";
    }
}

And I want to test it with chai

var Prodotto = artifacts.require("ProdottoFactory");
expect = require("chai").expect;


contract("descrizione primo test", function () {
    describe("test 2", function () {
        it("blablabla", function () {
            return Prodotto.new().then(
                istance => {
                    prodottoContract = istance;
                }
            )
        })
    })
})


contract("descrizione primo test2", function () {
    describe("test 2 2", function () {
        it("blablabla2",function () {
            return prodottoContract.foo().then(function (res) {
                expect(res.toString()).to.be.equal("foo")
            })
        })
    })
})

When I run the command truffle test I have this error

Error: Attempting to run transaction which calls a contract function, but recipient address 0xe8f29e5c4ca41c5b40ed989439ddeae4d9384984 is not a contract address

  • 1
    I think you need to put both describes under the same contract (and as a side note, you might even want to put both its under the same describe). – goodvibration Nov 7 '18 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.