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

Renaming tests to follow best practices #599

Closed
milosdjurica opened this issue Sep 4, 2024 · 0 comments
Closed

Renaming tests to follow best practices #599

milosdjurica opened this issue Sep 4, 2024 · 0 comments

Comments

@milosdjurica
Copy link

In the Foundry Book in Best Practices section there is a recommended way of naming tests, but the tests in this repo do not conform to this best practice. This is already issued in #273 .

I am open to rename those tests myself, but I just wanted to ask for some guidance before I make the changes.

Quick example :

function test_ChainNoDefault() public {

In the test/StdChains.t.sol there is a test that looks like this ->

    function test_ChainNoDefault() public {
        // We deploy a mock to properly test the revert.
        StdChainsMock stdChainsMock = new StdChainsMock();

        vm.expectRevert("StdChains getChain(string): Chain with alias \"does_not_exist\" not found.");
        stdChainsMock.exposed_getChain("does_not_exist");
    }

I am not sure how exactly to rename tests.

  • Simple way would be changing from test_ChainNoDefault() to the test_RevertIf_ChainNoDefault() .
  • But I think this doesn't make a lot of sense, so I was about to rename the test like this : test_RevertIf_ChainNotFound() .

Just wanted to know which is a preferred way? Should I just add _RevertIf_ part where needed, or change tests names completely, where it makes sense to do so?

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

No branches or pull requests

1 participant