-
Notifications
You must be signed in to change notification settings - Fork 34
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: standardize test function names across codebase #504
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for contracts-stylus canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @MukulKolpe but you have some name collisions both in motsu
and E2E tests. Please fix it 🙏
Please check failed CI jobs:
@@ -412,26 +412,26 @@ mod tests { | |||
} | |||
|
|||
#[motsu::test] | |||
fn default_role_is_default_admin(contract: AccessControl) { | |||
fn default_admin_role_success(contract: AccessControl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn default_admin_role_success(contract: AccessControl) { | |
fn get_role_admin_returns_default_admin_for_regular_role( | |
contract: AccessControl, | |
) { |
Don't forget the requirements:
function_name_description
for successful tests.
function_name
is the name of the function that is being tested, and this should apply to getters as well.
Double check that all the other test names follow this convention.
let role_admin = contract.get_role_admin(ROLE.into()); | ||
assert_eq!(role_admin, AccessControl::DEFAULT_ADMIN_ROLE); | ||
} | ||
|
||
#[motsu::test] | ||
fn default_admin_roles_admin_is_itself(contract: AccessControl) { | ||
fn default_admin_role_admin_success(contract: AccessControl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn default_admin_role_admin_success(contract: AccessControl) { | |
fn get_role_admin_returns_default_admin_for_default_admin_role( | |
contract: AccessControl, | |
) { |
@@ -522,7 +522,7 @@ mod tests { | |||
} | |||
|
|||
#[motsu::test] | |||
fn the_new_admin_can_grant_roles(contract: AccessControl) { | |||
fn role_admin_change_success_with_new_grant(contract: AccessControl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn role_admin_change_success_with_new_grant(contract: AccessControl) { | |
fn grant_role_succeeds_when_called_by_new_admin(contract: AccessControl) { |
grant_role
is actually being tested here- related to the comment above, make sure that all test case names follow the expected convention
This PR standardizes test function names across the codebase following a consistent pattern:
function_name_description
for successful tests.function_name_revert_when_condition
for tests expecting a revert.Resolves #491
PR Checklist