Questions tagged [test]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

How to make a deployer in truffle tests?

For some reason, our app will only work with a forked instance of the mainnet. And hence, we want to run our test on the forked ganache. We are using truffle, so we have written all of our tests in ...
-1
votes
1answer
70 views

I minted an NFT by mistake while in Rinkeby Test net on my wallet, the NFT sold for 1eth now it’s in my test wallet how do I recover this ETH?

This is the details of the transfer Buyer my1703 Transaction hash 0x5438b317f970448a040bba32b89c1e2c4ae306943764193a19d7e65739ae2283 You earned 1.007224 ETH Type of transaction Purchase Time sent Sun ...
0
votes
1answer
20 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
23 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
8 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
30 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
22 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
30 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
39 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
44 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
21 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
58 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
24 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?