Skip to content

Conversation

@Blue-B-code
Copy link

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.

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.

1 participant