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

Improve mocks #1146

Conversation

ericnordelo
Copy link
Member

@ericnordelo ericnordelo commented Sep 13, 2024

Fixes #1141

Depends on #1163

This PR centralizes mocks into the test_common package to avoid repetition and make them easier to maintain.

@ericnordelo ericnordelo changed the title Remove mocks from released packages Improve mocks Oct 3, 2024
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.51%. Comparing base (805e9cb) to head (46fd0ac).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1146   +/-   ##
=======================================
  Coverage   91.51%   91.51%           
=======================================
  Files          46       46           
  Lines        1178     1178           
=======================================
  Hits         1078     1078           
  Misses        100      100           
Files with missing lines Coverage Δ
packages/token/src/common/erc2981/erc2981.cairo 96.29% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 805e9cb...46fd0ac. Read the comment docs.

@ericnordelo ericnordelo marked this pull request as ready for review October 7, 2024 20:05
Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work, Eric! This for sure improves maintainability. I left some comments—really, only one actionable thing
LGTM!

Comment on lines +24 to +25
scarb 2.8.4 (2aa4e193e 2024-10-07)
cairo: 2.8.4 (https://crates.io/crates/cairo-lang-compiler/2.8.4)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Comment on lines +42 to +44
[[test]]
name = "openzeppelin_account_unittest"
build-external-contracts = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the name a requirement? Not that I'm against it if it's not, I'm just curious

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, because of a known issue with foundry and scarb.

packages/account/src/lib.cairo Show resolved Hide resolved
Comment on lines -1 to -15
mod mocks;

#[cfg(test)]
mod test_account;
#[cfg(test)]
mod test_erc1155;
#[cfg(test)]
mod test_erc20;
#[cfg(test)]
mod test_erc721;
#[cfg(test)]
mod test_eth_account;
#[cfg(test)]
mod test_universal_deployer;
#[cfg(test)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soooo much better 😄

packages/test_common/src/mocks/account.cairo Show resolved Hide resolved
@ericnordelo ericnordelo merged commit 1cbef43 into OpenZeppelin:main Oct 8, 2024
6 checks passed
@ericnordelo ericnordelo deleted the feat/remove-mocks-from-released-package-#1141 branch October 8, 2024 18:48
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.

Improve mocks organization
2 participants