Unit tests for Insuree Enquiry #224
Open
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.
Description
This PR introduces unit tests for the Insuree Enquire feature in the mobile policies module.
The tests validate that insuree information, policies, financial values, deductible structures, remaining benefits, photo handling, and scan results are correctly processed and exposed by the domain layer.
The Android environment and external dependencies are mocked to isolate business logic and ensure consistent behavior without backend or database access.
Type of change
Chore (Testing / CI)
CheckLists
Unit Tests added:
Enquire – Insuree without policies
insureeWithNoPolicies_ShouldShowNotCovered – PASSED ✅
Ensures insuree returns an empty policy list when not covered.
Enquire – Insuree with policies
insureeWithPolicies_ShouldHavePolicyList – PASSED ✅
Ensures linked policies are correctly attached and retrievable.
Policy – Deductible type validation
policyWithDeductionType1_HasCorrectProperties – PASSED ✅
policyWithDeductionType1_1_HasIPandOPValues – PASSED ✅
Ensures deductible and ceiling values are correctly mapped depending on policy type.
Policy – Remaining benefits mapping
policyWithAllAmountsLeft_HasCorrectValues – PASSED ✅
Ensures all benefit counters and remaining amounts are preserved.
Policy – Expiry handling
policyWithNullExpiryDate_IsNotExpired – PASSED ✅
Ensures policies with null expiry dates remain ACTIVE.
Insuree – Photo handling
insureeWithPhoto_HasPhotoData – PASSED ✅
insureeWithPhotoPath_HasPhotoPathString – PASSED ✅
Ensures insuree photo data and path are correctly stored.
Insuree – Basic information integrity
insureeBasicInfo_IsCorrect – PASSED ✅
Ensures CHFID, name, gender, and DOB are correctly mapped.
Policy – Status validation
policyStatusValues_AreValid – PASSED ✅
Ensures different policy statuses are correctly distinguished.
Insuree – Multiple policy linkage
multiplePoliciesToInsuree_AllPresent – PASSED ✅
Ensures insuree supports multiple policies without loss.
Scan & Validation
scanQRCodeIntent_HasCorrectAction – PASSED ✅
scanResultIntent_ContainsChfid – PASSED ✅
escapeCheckInsuranceNumber_ValidNumber_ReturnsZero – PASSED ✅
Ensures QR scan and insurance number validation behave correctly.
Policy – Value & deduction consistency
policyWithValue_HasCorrectValue – PASSED ✅
policyDeductionCalculation_Type1 – PASSED ✅
policyDeductionCalculation_Type1_1 – PASSED ✅
Ensures financial and deductible logic consistency.
Notes
Backend calls are not executed; Policy and Insuree data are mocked to isolate logic.
Android components are simulated using Robolectric.
Escape validation logic is tested without external dependencies.
Tests ensure data integrity and correct mapping of insuree enquiry results.