How to check if a function was fired #4544
Unanswered
Mahmood-Darwish
asked this question in
Q&A
Replies: 2 comments 2 replies
-
you can use events.
in your tests. |
Beta Was this translation helpful? Give feedback.
2 replies
-
@Mahmood-Darwish You can use the hardhat console contract for it. Import the contract in your contract import "hardhat/console.sol"; After that use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone.
I'm working on some tests for my project and I want to check the execution flow of my contract.
Basically, I want to call method A in my contract. It would make a vrf request (which I have mocked), the vrf then would call fulfillrandomwords, and fulfillrandomwords should call method B.
I want to call A and check if B was called. Not sure how to do that.
I messed around a lot with chai spies and I wasn't able to get it working. I have the following code:
play is method A and blackOrRed is method B. This test always fails even if I put
const spy = chai.spy.on(game, "play")
which it obviously shouldn't since I'm literally calling it by hand.Beta Was this translation helpful? Give feedback.
All reactions