dhiway / cord

CORD - Enterprise Blockchain Framework
https://cord.network
GNU General Public License v3.0
123 stars 106 forks source link

feat: Added Tests for ReferenceIdentifierNotFound #506

Closed JiyaGupta-cs closed 2 weeks ago

JiyaGupta-cs commented 3 weeks ago

Fixes #301

Description

This pull request adds test coverage for the ReferenceIdentifierNotFound error 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 test

Screenshots

dhiway

zeel991 commented 3 weeks ago

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

rustfmt tests.rs

To pass the rustfmt github action

JiyaGupta-cs commented 3 weeks ago

@zeel991 I have done rustfmt for tests.rs now Please review it again

zeel991 commented 3 weeks ago

hey @JiyaGupta-cs , In the revise rating function , you are trying to return ReferenceNotDebitIdentifier rather than ReferenceIdentifierNotfound error . To return ReferenceIdentifierNotfound , try registering and revoking the ratings and then remove the identifier created from the digest id of revoke rating function , then try revising the rating , you will get the correct error

JiyaGupta-cs commented 3 weeks ago

@zeel991 Now. I have fixed all the errors as mentioned I have successfully registered the rating and revoked the rating , and then removed message id, then removed the identifier from the RatingEntries storage to trigger the ReferenceIdentifierFotFound error while revising the rating

JiyaGupta-cs commented 2 weeks ago

@zeel991 @vatsa287 I have removed the changes of lib.rs And the tests are working error-free

image

zeel991 commented 2 weeks ago

@zeel991 @vatsa287 I have removed the changes of lib.rs And the tests are working error-free

image

Interesting , it seems your test is working on linux , but throws error on windows , @vatsa287 can you look into this please

JiyaGupta-cs commented 2 weeks ago

@zeel991 @vatsa287 I have removed the changes of lib.rs And the tests are working error-free image

Interesting , it seems your test is working on linux , but throws error on windows , @vatsa287 can you look into this please

Sir it's the last day for the PR to get merged in Augtoberfest in C4GT @zeel991 @vatsa287

JiyaGupta-cs commented 2 weeks ago

@amarts Please review and merge the PR