Questions tagged [mock]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers

Is VRFCoordinatorV2Mock working on mainnet forking or only in local network?

I'm testing my contracts, where I use Chainlink's VRF. I use the mainnet forking in a hardhat. I deployed VRFCoordinatorV2Mock, although it doesn't seem to work. Is VRFCoordinatorV2Mock supposed to ...
cutedwannabe's user avatar
0 votes
1 answer

How to specify return value of chainlink MockOracle

I want to test my smart contract locally using chainlink MockOracle how can i specify the returned value and the job Id ?
noro meb's user avatar
  • 328
2 votes
0 answers

Simulate transaction replacement on go-ethereum SimulatedBackend

i'm writing in go-lang and using go-ethereum package to interact with nodes. For testing purposes go-ethereum provides blockhchain simulation via SimulatedBackend (
Andrey Obruchkov's user avatar
0 votes
1 answer

ReferenceError: MockV3Aggregator is not defined , getting this error while deploying mock contract

Getting this error while deploying mock contract ReferenceError: MockV3Aggregator is not defined Imported MockV3Aggregator from chainlink's github and now it's in my node modules also. This is my ...
Aman's user avatar
  • 23
0 votes
1 answer

Getting error while deploying VRFCooridnatorV2Mock

this is deploy script for mock const{getNamedAccounts, deployments, network, ethers}=require("hardhat"); const baseFee=ethers.utils.parseEther("0.25"); const gasFee= 1e9; module....
SANJAY DUTT's user avatar
3 votes
2 answers

Override mock contracts's address in test

I have a smart contract that is dependent on a pre-deployed ERC-20 smart contract that is always deployed to the same address (in the local test network as well as public ones). I want to override the ...
OneThunder's user avatar
1 vote
1 answer

Test if a smart contract function has been called

In my hardhat project I'm testing my smart contracts using chai. For the sake of simplicity let's assume my contract is: contract MyContract { function a() external { b(); } function b() ...
forhas's user avatar
  • 765
0 votes
1 answer

How to mock an instance of an interface?

Having these interfaces interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address ...
JP Segurado's user avatar
5 votes
2 answers

How to mock ethereum provider for unit testing of REST API with jest?

How to mock a ethereum provider for unit testing of REST API? REST API has following basic structure(index.js)where provider,wallets are created using web3HttpProvider and etherjs when server is ...
Vineeta's user avatar
  • 51
4 votes
2 answers

How to mock smart contract function for testing (in hardhat)

In my Test I want to mock an external function that I call inside my smart contract to test both conditions without writing and deploying an extra fake smart contract. My Contract //SPDX-License-...
Majd TL's user avatar
  • 3,177
1 vote
0 answers

Integration Tests for Smart Contracts

So we write integration tests in order to test interactions between contracts. Could be interactions with on-chain contracts and also off-chain services. When it comes to unit tests, I think I have a ...
anusha garimella's user avatar
0 votes
2 answers

How to create your own Mock contract if one does not exist

Is there a guide on how to create your own Mock contracts in order to properly test smart contracts on local network? And how to conclude if one corresponds to the idea, and meets the requirements of ...
Sevasoft's user avatar
3 votes
1 answer

Struggling with waffle - mock not initialized

I've got problem with mocking method call. Below is my solidity code and test. I would like to pass mock into withdraw method and check if transfer function was called. But instead I am getting error &...
Tomasz Kulig's user avatar
2 votes
1 answer

How to mock out a signed transaction w/ Waffle Mocks?

When applying Waffle mock to simulate a contract method that must be explicity signed an error is thrown: Error: Contract with a Signer cannot override from (operation="overrides.from", code=...
Juan Ignacio Pérez Sacristán's user avatar