Comments (3)
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.
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.
For some reason it works now. Thank you very much for your help!
from ethereum-solidity-course-updated-code.
Related Issues (14)
- Could you explain why you used abi.encodePacked? HOT 3
- Important Solidity compiler version note HOT 4
- Solidity 0.8 Update HOT 6
- 'VM Exception while processing transaction: out of gas' error may occur in Campaign tests
- SyntaxError: Unexpected token u in JSON at position 0 (factory.js) HOT 2
- Code improvement HOT 1
- Getting 'TypeError: Cannot read property 'Inbox.sol' of undefined' when running compile.js on Inbox.sol HOT 5
- Web3 Error
- All course projects in Typescript HOT 6
- TypeError: Cannot read properties of undefined (reading '0') HOT 2
- Error in Kickstart solidity code. "false transaction mined but execution failed" in createRequest().
- Error in run tests: Error: The contract code couldn't be stored, please check your gas limit.
- Update Solidity latest version note in README
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ethereum-solidity-course-updated-code.