defi-wonderland / smock

The Solidity mocking library
MIT License
321 stars 39 forks source link

how to unfake fake one. #180

Open novaknole opened 1 year ago

novaknole commented 1 year ago
it("test 1", async () => {
   const fake = await smock.fake("contractExample", {
         address: contractExample.address
   })

   expect(fake.execute).has.been.calledWith(1); // Works great
})

it("test 2", async () => {
   await contractExample.getAction(); 
})

Problem is that I deploy contractExample in before hook, only one time. in test1, I replace it with fake, but in test2, I need the original one, because await contractExample.getAction(); returns 0x...0, since it became a fake. How can I reset it in test1, so on contractExample.address, even in test 2, we got fake, and I need original.

How can I achieve it ?