Questions tagged [test]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

How can I test my purchase function on the truffle with chai?

I'm trying to test my token buying function but I encounter an error, o facilitate understanding I will show the code "Error: Returned error: VM Exception while processing transaction: revert&...
0
votes
1answer
20 views

I want to understand something with BigNumber assertions

I have create a truffle project with a smartcontract and a test file. Here is an extract of the test file: expect(ret).to.be.bignumber.equal(new BN('42')); ret is a value returned by a smartcontract'...
0
votes
0answers
7 views

Automated tests with brownie - how to handle “base fee exceeds gas limit”

I have wrote this very basic test scenario with brownie: import pytest def test_set_get_18(tcontrat1,accounts): tcontrat1.set(18, {'from': accounts[0],'gas_limit':100}) assert tcontrat1.get() ...
1
vote
0answers
9 views

Problem of VMTest

Recently I implement the EVM, but when I check the test suit of VMTest. I found that if the storage of key and value are both 0x00, the storage is empty in the "post" section after executing ...
0
votes
0answers
24 views

Truffle test doesn't recognize estimateGas function

I'm trying to test my contracts using Truffle and Ganache, but I'm facing some problems with some functions. When I call a non view function, I'm getting the error "out of gas". Moreover, if ...
0
votes
0answers
19 views

Wrong contract balance shown by web3.eth.getBalance

I want to test if the balance updates when I send some eths it("the balance matches the price of a person", async function(){ let instance = await People.deployed() await instance....
0
votes
1answer
28 views

How I can do steps in the truffle test?

I'm testing AMM, so I have steps like add liquidity, try to swap remove liquidity etc I can just add it in one it block like this answer suggests contract('amm', (accounts) => { it ("...
0
votes
0answers
30 views

Truffle “test” is passing only 1 it(“”) test instead of showing “all 3 tests passed”

MyToken.sol //// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MyToken is ERC20 { constructor(uint256 ...
0
votes
0answers
23 views

“before each” hook error while run truffle test command

I ran truffle test command on my project for testing but I got an error like this: "before each" hook for "1- should be return true Pauser Role for account[0]" why I'm getting ...
0
votes
1answer
18 views

Time-dependent test unexpected behavior at 1st attempt, expected behavior at 2nd attempt

I'm trying to test a contract in which functions should require certain timestamps. Parts of code are eliminated for readability: Here's the problematic part of the contract : PCE_Contract.sol pragma ...
1
vote
1answer
54 views

How to test abstract contracts using truffle?

Is it possible to test abstract contract using truffle? If yes, how I can to do it?
0
votes
1answer
23 views

Test for Require statement in Truffle

I wrote a function that generate a key value. the function codes is here mapping(string => bool) processedHash; mapping(uint => bool) HashList; function generateHash(uint256 ...
0
votes
0answers
26 views

How to assign event output to variable when testing?

I'm using Truffle test(chai/mocha) and openzeppelin-test-helpers. Can anyone help me about how to assign values from event to variables in the above testing environment?