-
Notifications
You must be signed in to change notification settings - Fork 125
feat: Added Tests for ReferenceIdentifierNotFound #506
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
feat: Added Tests for ReferenceIdentifierNotFound #506
Conversation
|
Hey @JiyaGupta-cs , you can go to the To pass the rustfmt github action |
|
@zeel991 I have done rustfmt for tests.rs now |
|
hey @JiyaGupta-cs , In the revise rating function , you are trying to return |
pallets/network-score/src/tests.rs
Outdated
| println!("Revise rating result: {:?}", result); | ||
|
|
||
| // Check for the correct error | ||
| assert_err!(result, Error::<Test>::ReferenceNotDebitIdentifier); |
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.
Change the error returned to ReferenceIdentifierNotFound
| message_id.clone(), | ||
| authorization_id.clone(), | ||
| )); | ||
|
|
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.
Refer the revise_rating_with_existing_rating_identifier_should_fail() method in the tests.rs file to correctly call the revoke_rating function
|
@zeel991 Now. I have fixed all the errors as mentioned |
| let auth_digest = <Test as frame_system::Config>::Hashing::hash( | ||
| &[&space_id.encode()[..], &creator.encode()[..], &creator.encode()[..]].concat()[..], |
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.
let auth_digest = <Test as frame_system::Config>::Hashing::hash(
&[&space_id.encode()[..], &creator.encode()[..]].concat()[..],
);
Correct this declaration of auth_digest , or else it will give AuthorizationNotFound Error
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.
In all other functions too
let auth_digest = <Test as frame_system::Config>::Hashing::hash(
&[&space_id.encode()[..], &creator.encode()[..], &creator.encode()[..]].concat()[..],
);
this is used
on using the below snippet does not meet the requirements
let auth_digest = <Test as frame_system::Config>::Hashing::hash(
&[&space_id.encode()[..], &creator.encode()[..]].concat()[..],
);
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.
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.
Sir my test is running fine, because if we give only two requirements as mentioned by you , the length would be short then it would give error. but the snippet which I have used is running error-free
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.
Sir my test is running fine, because if we give only two requirements as mentioned by you , the length would be short then it would give error. but the snippet which I have used is running error-free
Sir my test is running fine, because if we give only two requirements as mentioned by you , the length would be short then it would give error. but the snippet which I have used is running error-free
Sir my test is running fine, because if we give only two requirements as mentioned by you , the length would be short then it would give error. but the snippet which I have used is running error-free
Can you run this command and check if the tests are running error-free
cargo test --release --locked --features=runtime-benchmarks --no-fail-fast --verbose --color always -p pallet-network-score --lib
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.
vatsa287
left a comment
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.
lib.rs changes are not required for this test change.
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.
Rebase your branch with develop:latest to avoid conflicts. As changes have been made into this file recently.
Sir it's the last day for the PR to get merged in Augtoberfest in C4GT @zeel991 @vatsa287 |
vatsa287
left a comment
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.
LGTM
|
@amarts Please review and merge the PR |
Fixes #301
Description
This pull request adds test coverage for the
ReferenceIdentifierNotFounderror in the pallet-network-score module.Changes Made
Added a new test case to assert the correct return of the ReferenceIdentifierNotFound error in various calls across the pallet-network-score.
Ensured that all functions which can return this error are validated, either individually or collectively in a single test.
Implementation Details
Followed the structure and approach of existing test cases
Tests were run and verified using
cargo test -p pallet-network-score testScreenshots