Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor tests with expectEmit #657

Merged
merged 1 commit into from
May 28, 2023

Conversation

rndquu
Copy link
Member

@rndquu rndquu commented May 25, 2023

In the latest foundry version the tests are failing with:

Encountered 1 failing test in test/diamond/facets/BondingCurveFacet.t.sol:ZeroStateBonding
[FAIL. Reason: Expected an emit, but no logs were emitted afterward. You might have mismatched events or not enough events were emitted. Counterexample: calldata=0x5fffbbe400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, args=[0, 0]] testDeposit(uint32,uint256) (runs: 0, μ: 0, ~: 0)

Encountered 1 failing test in test/diamond/facets/StakingFacet.t.sol:ZeroStateStakingTest
[FAIL. Reason: Expected an emit, but no logs were emitted afterward. You might have mismatched events or not enough events were emitted. Counterexample: calldata=0xc237edba00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, args=[0, 0]] testDeposit_Staking(uint256,uint256) (runs: 0, μ: 0, ~: 0)

It happens because vm.expectEmit() now works only for the next call

This PR refactors vm.expectEmit() to be called right before a function that emits an expected event

@rndquu rndquu requested review from 0x4007 and zgorizzo69 May 25, 2023 14:07
@ubiquibot
Copy link

ubiquibot bot commented May 25, 2023

@0x4007 0x4007 merged commit 160fd6d into ubiquity:development May 28, 2023
@rndquu rndquu deleted the test/fix-expect-emit branch June 23, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants