Repository navigation
Feat/primitives - #1161
Merged
Merged
Feat/primitives#1161
Conversation
… TTL primitives are uncovered
…overed: restore flows have no e2e path
|
@nafiuishaaq Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
nanaf6203-bit
approved these changes
Aug 31, 2026
DeFex-lab
pushed a commit
to DeFex-lab/PropChain-BackEnd
that referenced
this pull request
Oct 12, 2026
DeFex-lab
pushed a commit
to DeFex-lab/PropChain-BackEnd
that referenced
this pull request
Oct 15, 2026
DeFex-lab
pushed a commit
to DeFex-lab/PropChain-BackEnd
that referenced
this pull request
Oct 22, 2026
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.
Summary of Changes
Created a new test file [
test/cache/cache.service.e2e-spec.ts](file:///c:/Users/hp/Desktop/wave 8/PropChain-BackEnd/test/cache/cache.service.e2e-spec.ts) that tests all the core cache functionality against a real Redis instance, using the existing e2e test harness. The tests cover:1. Lock Acquisition (setNx primitive)
2. TTL Behavior
3. Tag-based Invalidation
4. Additional Core Functionality
Test Architecture
The tests run against a real Redis instance as required (since distributed primitives like locks and TTLs can't be properly tested with mocks), using the same NestJS testing module setup as the existing cache tests. Each test is isolated with cache clearing before execution to prevent cross-test contamination.
Coverage Impact
These tests will significantly improve the coverage of the cache module, which previously only had tests for metrics and stats. The new tests exercise all the uncovered primitives:
setNx(distributed locking)invalidateByTag(tag-based invalidation)Summary of Changes
Created a new test file [
test/backup/backup.service.e2e-spec.ts](file:///c:/Users/hp/Desktop/wave 8/PropChain-BackEnd/test/backup/backup.service.e2e-spec.ts) that tests all the core backup functionality against a real Prisma test database, using the existing e2e test harness. The tests cover:1. Schedule Refresh on Boot (
onModuleInit)ensureScheduleConfigcreates the default schedule if it doesn't exist2. Status Reporting
getSchedulereturns the current configurationlistBackupsreturns backups in correct descending chronological order3. Restore Flow (Success and Failure Cases)
NotFoundExceptionfor non-existent backupsNotFoundExceptionwhen backup file is missing from storageConflictExceptionwhen another job is already running4. Additional Core Functionality
Test Architecture
The tests run against a real Prisma test database as required (since restore and scheduling logic can't be properly tested with mocks alone). We use Jest to mock the child_process execFile calls to avoid actually running pg_dump/psql in the test environment, while still testing all the surrounding logic. Each test is isolated with proper cleanup before and after execution.
Coverage Impact
These tests will significantly improve the coverage of the backup module, which previously only had limited unit tests. The new tests exercise all the uncovered primitives:
onModuleInitschedule refresh on bootThe tests are ready to be run with
npm testand will execute in CI along with the existing test suite.