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

refactor: rename tests with error assertions #161

Closed
wants to merge 1 commit into from

Conversation

postmeback
Copy link

Changes as per the mentioned issue. It's a work in progress, requesting a quick review. Will continue working on it, if the initial changes are fine.

Resolves #155

PR Checklist

The below items are not applicable as such, because it is more about renaming tests to a particular naming convention.

  • Tests
  • Documentation

Copy link

netlify bot commented Jun 27, 2024

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit fe27221
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/667cf81f4f42670008baa5d5

Copy link
Member

@qalisander qalisander left a comment

Choose a reason for hiding this comment

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

Hey @postmeback!
Appreciate your contribution!
Here are few comments I have:

@@ -1141,21 +1141,18 @@ mod tests {
}

#[motsu::test]
fn balance_of_zero_balance(contract: Erc721) {
fn error_when_contract_balance_is_zero_balance(contract: Erc721) {
Copy link
Member

Choose a reason for hiding this comment

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

I can see this test is not checking any error. I think we are not expecting to change its name. cc @bidzyyys

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, we should rename only when we check errors in tests.

contract
._mint(alice, token_id)
.expect("should mint the token a first time");
.expect("should mint the token the first time");
Copy link
Member

Choose a reason for hiding this comment

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

good

@@ -1165,14 +1162,13 @@ mod tests {
}

#[motsu::test]
fn mints(contract: Erc721) {
fn when_minting_token_balance_and_owner_are_correct(contract: Erc721) {
Copy link
Member

Choose a reason for hiding this comment

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

In this test we're also not checking for any error. Seems make sense to leave it as it is. cc @bidzyyys

Copy link
Collaborator

Choose a reason for hiding this comment

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

mints is fine here. The task is to rename tests that checks errors.

@qalisander qalisander changed the title Initial Changes refactor: rename tests with error assertions Jun 27, 2024
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.4%. Comparing base (0197073) to head (fe27221).

Additional details and impacted files
Files Coverage Δ
contracts/src/token/erc721/mod.rs 96.0% <100.0%> (-0.1%) ⬇️

@alexfertel
Copy link
Contributor

Hey @postmeback! We're really sorry about this, but after some discussion, we found that renaming the tests this way hides away the intent of the test, so we don't think it's worth the trade-off.

As such, I'll be closing the PR, since we won't be proceeding with these changes anymore. Hopefully this doesn't deter you from contributing to our library! Thanks.

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.

[Refactor]: apply same naming convention for all tests that check errors
4 participants