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

Added tests for smart contract #22

Merged
merged 8 commits into from
Nov 30, 2022
Merged

Added tests for smart contract #22

merged 8 commits into from
Nov 30, 2022

Conversation

bucurdavid
Copy link
Member

No description provided.

Copy link
Member

@damienen damienen left a comment

Choose a reason for hiding this comment

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

Small code readability stuff

.execute_query(&setup.contract_wrapper, |sc| {
sc.require_value_is_positive(&managed_biguint!(0u64));
})
.assert_error(4, "Value must be positive");
Copy link
Member

Choose a reason for hiding this comment

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

Error returned by that function should be changed to "Value must be higher than or equal to zero" if it accepts 0, too. Value must be positive can be misleading

}

#[test] //Tests the whitelist functionality
fn white_list_test() {
Copy link
Member

Choose a reason for hiding this comment

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

Name is too similar to the other whitelist_test

@@ -127,6 +137,43 @@ fn pause_test() {
.assert_ok();
}

#[test] // Tests if the contract has whitelist enabled and is empty
Copy link
Member

Choose a reason for hiding this comment

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

Should change comment to "Tests if the contract has whitelist enabled and is empty by default after deployment"

@@ -127,6 +137,43 @@ fn pause_test() {
.assert_ok();
}

#[test] // Tests if the contract has whitelist enabled and is empty
// Tests if the royalties and supply are set accordingly
fn whitelist_test() {
Copy link
Member

Choose a reason for hiding this comment

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

Why is the test named whitelist_test if it also tests royalties?

}

#[test] // Tests burn functionality
fn burn_token_tests() {
Copy link
Member

Choose a reason for hiding this comment

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

This method is named "tests" while the others are named "test". Small detail, but generally we should try following a pattern

@damienen damienen merged commit 403fec0 into main Nov 30, 2022
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.

2 participants