Skip to content

feat: implement is_valid_loan() with tests#31

Merged
jaykayudo merged 1 commit intoTrajectfi:mainfrom
emarc99:main
Jun 6, 2025
Merged

feat: implement is_valid_loan() with tests#31
jaykayudo merged 1 commit intoTrajectfi:mainfrom
emarc99:main

Conversation

@emarc99
Copy link
Contributor

@emarc99 emarc99 commented Jun 5, 2025

Description

Implented the is_valid_loan functionality based on stated requirements.

Test Coverage Explanation:

  1. Positive Case:

    • test_is_valid_loan_positive: Tests a properly initialized loan with ONGOING status
  2. Negative Cases:

    • test_is_valid_loan_non_existent: Tests with a loan ID that doesn't exist

    • test_is_valid_loan_zero_id: Tests with loan_id = 0

    • test_is_valid_loan_mismatched_id: Tests when storage key doesn't match loan.id

    • test_is_valid_loan_uninitialized: Tests NOT_INITIALIZED status

  3. Edge Cases:

    • test_is_valid_loan_repaid_status: Validates that REPAID loans are still considered valid

    • test_is_valid_loan_foreclosed_status: Validates that FORECLOSED loans are still considered valid

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Configuration change

Checklist

Development Best Practices

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing tests pass locally with my changes

Testing

  • Unit tests cover the new functionality
  • Integration tests verify the changes work with other components

Related Issues

Screenshots / Logs (if applicable)

image

Additional Context

@emarc99
Copy link
Contributor Author

emarc99 commented Jun 5, 2025

@jaykayudo, kindly review and let me know if any adjustments are needed. Thanks!

Copy link
Contributor

@jaykayudo jaykayudo left a comment

Choose a reason for hiding this comment

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

LGTM! @emarc99
Nice job and Thank you

@jaykayudo jaykayudo merged commit 7cebebe into Trajectfi:main Jun 6, 2025
2 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.

Implement is_valid_loan Functionality

2 participants