Giter VIP home page Giter VIP logo

Comments (3)

owanhunte avatar owanhunte commented on August 27, 2024

Hi @kurtappelmans, sorry for the late response. I assume you mean setMessage().send() instead of setMessage().call(). Could you share the full contents of your Inbox.test.js test file?

from ethereum-solidity-course-updated-code.

kurtappelmans avatar kurtappelmans commented on August 27, 2024

Dear, thank you for your reply. I'm basically using your code:

const assert = require("assert");
const ganache = require("ganache-cli");
const Web3 = require("web3");
const provider = ganache.provider();
const web3 = new Web3(provider);
const { abi, evm } = require("../compile");

const message = "Hi there!";
let accounts;
let inbox;

beforeEach(async () => {
// Get a list of all accounts.
accounts = await web3.eth.getAccounts();

// Use one of those accounts to deploy the contract.
inbox = await new web3.eth.Contract(abi)
.deploy({ data: "0x" + evm.bytecode.object, arguments: [message] })
.send({ from: accounts[0], gas: "900000" });
});

describe("Inbox", () => {
it("deploys a contract", () => {
assert.ok(inbox.options.address);
});

it("has a default message", async () => {
const msg = await inbox.methods.message().call();
assert.strictEqual(msg, message);
});

it("can change the message", async () => {
const newMsg = "bye";
await inbox.methods.setMessage(newMsg).send({ from: accounts[0] });

const msg = await inbox.methods.message().call();
assert.strictEqual(msg, newMsg);

});
});

from ethereum-solidity-course-updated-code.

kurtappelmans avatar kurtappelmans commented on August 27, 2024

For some reason it works now. Thank you very much for your help!

from ethereum-solidity-course-updated-code.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.