Questions tagged [mock]
The mock tag has no usage guidance.
14
questions
1
vote
0
answers
57
views
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 ...
0
votes
1
answer
21
views
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 ?
2
votes
0
answers
248
views
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 (https://github.com/ethereum/go-...
0
votes
1
answer
80
views
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 ...
0
votes
1
answer
106
views
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....
3
votes
2
answers
433
views
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 ...
1
vote
1
answer
212
views
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() ...
0
votes
1
answer
171
views
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 ...
5
votes
2
answers
2k
views
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 ...
4
votes
2
answers
3k
views
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-...
1
vote
0
answers
242
views
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 ...
0
votes
2
answers
392
views
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 ...
3
votes
1
answer
352
views
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 &...
2
votes
1
answer
396
views
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=...