Repository navigation
test: add coverage for loan check cron overlap (#2116) and PII encryp… - #2169
Merged
Merged
Conversation
…II encryption idempotency (LabsCrypt#2115) - loanCheckCron.test.ts: add tests for success/failure paths, overlap prevention, duplicate notification prevention, and boundary conditions - encryptUserProfilePii.test.ts: add tests for success/failure paths, idempotent reruns, partial failures, already-encrypted profiles, and boundary conditions
Malware detection scan flagged this pull requestThe scan found 1 indicator(s) in the PR diff. This PR is blocked until a maintainer reviews the flagged files.
This is an automated triage signal; maintainers must verify whether the finding is malicious or intentional. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Test Coverage for Loan Check Cron Overlap (#2116) and PII Encryption Idempotency (#2115)
close #2116
close #2115
Summary
This PR adds comprehensive test coverage for two focused regression gaps identified in the testing sweep:
Changes
Files Modified
backend/src/cron/__tests__/loanCheckCron.test.ts- Enhanced existing test filebackend/src/scripts/__tests__/encryptUserProfilePii.test.ts- New test file#2116: Loan Check Cron Overlap Prevention
Background
The
loanDueCheckCronruns hourly to notify borrowers of upcoming repayments. It uses aninFlightflag to prevent overlapping executions, but this critical behavior lacked test coverage.Tests Added
Key Test: Overlap Prevention
This test verifies the warning log:
"Loan due check cron skipped because a previous run is still in flight"#2115: PII Encryption Script Idempotency
Background
The
encryptUserProfilePiiscript (npm run pii:backfill) is a one-off migration that encrypts legacy plaintext PII. It must be idempotent (safe to re-run) and handle partial failures gracefully. These behaviors were untested.Tests Added
8/10 rows encrypted)Key Test: Idempotent Reruns
Test Results
Verification
Run the specific tests:
Run full suite:
Checklist