Questions tagged [test]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
16 views

Openzeppelin test helper with hardhat config and tests

I'm using hardhat and I added a task to manipulate time in the hardhat.config.js file which is working fine. require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-truffle5&...
0
votes
1answer
14 views

Balance of contract

I am testing a smart contract but I have troubles accessing the balance of the contract in my javascript test file. For simplicity assume this is my smart contract: contract Donation{ function ...
1
vote
0answers
11 views

Is necesary pass a Dapp to mainnet or in testnet is ok for a production smart contract process? [duplicate]

Because the client Dapp propietary don´t have real Ether, only Ropsten test Ether via faucet.ropsten.be/ is necesary buy Real Ether to preserve smart contracts in ethereum or in Ropsten testnetwok is ...
0
votes
1answer
43 views

Verify a signature generated with web3 in solidity

I am trying to verify a signature in solidity, which I generated in my truffle test. I followed this tutorial for implementing the smart contract, but made small adjustions: library Lib { /** ...
0
votes
0answers
20 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
190 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
44 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
48 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
12 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
10 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
51 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
28 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
49 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
57 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
118 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
24 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
74 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
34 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?