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

Fixes: Network-Score: Add tests for 'InvalidRatingValue' #297 #507

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

mrswastik-robot
Copy link
Contributor

@mrswastik-robot mrswastik-robot commented Sep 14, 2024

Fix for #297

Added the code in test.rs file which tests for the invalid rating value.

The test case is running successfully:
image

Do let me know if any kind of changes or improvements are required!!

@zeel991
Copy link
Contributor

zeel991 commented Sep 16, 2024

Hey @mrswastik-robot , you can go to the src folder of network-score pallet and run the command

rustfmt tests.rs

To pass the rustfmt github action

@mrswastik-robot
Copy link
Contributor Author

hey @zeel991, thanks for helping me out, I have run the rustfmt command, can you review it now

@VedantKhairnar
Copy link

Hello @mrswastik-robot
Will you pls also mention the Issue number in the PR as per this.
Thanks.

invalid_message_id.clone(),
authorization_id.clone()
),
Error::<Test>::InvalidRatingValue
Copy link
Member

Choose a reason for hiding this comment

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

InvalidRatingValue is also used in revise_rating. Please add that tests for that also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @vatsa287 , is it revise_rating_with_entry_entity or revise_rating_with_existing_rating ?

Copy link
Member

Choose a reason for hiding this comment

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

No InvalidRatingValue is being returned from two extrinsics. One being register which you already done. Now you have to add it for revise as well. Look at lib.rs file, where all this is being returned from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @vatsa287 for helping me out, I read lib.rs file and have added a test function revise_rating_with_invalid_values_should_fail in the latest commit. Please review and let me know if further changes are required

vatsa287
vatsa287 previously approved these changes Sep 17, 2024
Copy link
Member

@vatsa287 vatsa287 left a comment

Choose a reason for hiding this comment

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

LGTM

@vatsa287 vatsa287 requested review from amarts and removed request for amarts September 17, 2024 09:08
@vatsa287 vatsa287 requested a review from amarts September 19, 2024 12:28
@amarts amarts merged commit 9f1fb46 into dhiway:develop Sep 20, 2024
3 checks passed
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.

5 participants