The below is my inbox.test.js file code:
const assert = require('assert'); const ganache = require('ganache-cli'); const {Web3} = require('web3'); const web3 = new Web3(ganache.provider()); const {abi, bytecode} = require('../compile');
let accounts; let inbox;
beforeEach(async () => { accounts = await web3.eth.getAccounts();
inbox = await new web3.eth.Contract(abi) .deploy({data: bytecode, arguments: ['Success!'] }) .send({ from: accounts[0], gas: '1000000'});
});
describe('Inbox', () => { it('deploys a contract', () => { console.log(inbox); });
it("sets the contract message", async () => {
await inbox.methods
.setMessage("test message")
.send({ from: accounts[0], gas: "1000000" });
});
});
The error is as follows:
Inbox 1) "before each" hook for "deploys a contract"
0 passing (233ms) 1 failing
"before each" hook for "deploys a contract": Web3ContractError: The number of arguments is not matching the methods required number. You need to pass 0 arguments.
at encodeMethodABI (node_modules\web3-eth-contract\src\encoding.ts:190:9) at getSendTxParams (node_modules\web3-eth-contract\src\utils.ts:75:26) at ContractBuilder._contractMethodDeploySend (node_modules\web3-eth-contract\src\contract.ts:1062:29) at Object.send (node_modules\web3-eth-contract\src\contract.ts:608:17) at Context. (test\inbox.test.js:16:13) at processTicksAndRejections (node:internal/process/task_queues:95:5)
Please help me with this. This is my first ever smart contract.