Skip to content

Instantly share code, notes, and snippets.

@ben-chain
Created December 19, 2020 03:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ben-chain/2f1c76a45ef520df013fba26bb83fc33 to your computer and use it in GitHub Desktop.
Example usage of the smock Hardhat plugin
import { ethers } from 'hardhat'
import { smockit } from '@eth-optimism/smock'
const MyContractFactory = await ethers.getContractFactory('MyContract')
// Smockit!
const MyMockContract = await smockit(MyContractFactory)
MyMockContract.myFunction.will.return.with('Some return value!')
console.log(await MyMockContract.myFunction()) // 'Some return value!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment