Skip to content

Commit

Permalink
Fixed logic that skips citizenship select status page.
Browse files Browse the repository at this point in the history
Adds tests for this as well.
  • Loading branch information
bseeger committed Feb 7, 2024
1 parent a72e4b6 commit d25214d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.stereotype.Component;

@Component
public class AllUsCitizens extends BasicCondition {
public class AllUSCitizens extends BasicCondition {

@Override
public Boolean run(Submission submission) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ flow:
- name: citizenshipQuestion
citizenshipQuestion:
nextScreens:
- name: incomeSignPost
- name: householdVeteran
condition: AllUSCitizens
- name: citizenshipSelectStatus
citizenshipSelectStatus:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,19 @@ void raceEthnicityFlow() {
assertThat(testPage.getTitle()).isEqualTo("Race Selection");
}

@Test
void allCitizensSkipSelectStatusPage() {
loadUserPersonalData();
loadHouseHoldData("First", "User", "12", "22", "1991");
loadHouseHoldData("Second", "User", "01", "23", "1997");

testPage.navigateToFlowScreen("mdBenefitsFlow/citizenshipIntro");
testPage.clickContinue();

testPage.clickButton(message("general.inputs.yes"));
assertThat(testPage.getTitle()).isEqualTo(message("veteran.title"));
}

@Test
void docUploadSkipTest() {
testPage.navigateToFlowScreen("mdBenefitsFlow/docUploadIntro");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class MoveCitizenshipDataTest {
private final MoveCitizenshipData action = new MoveCitizenshipData();
private final String INPUT_FIELD_NAME = "citizenshipStatus";
private final String HOUSEHOLD_FIELD_NAME = "householdMemberCitizenshipStatus";
private final String APPLICANT_FIELD_NAME = "applicantCitizenshipStatus";

@Test
public void moveDataIntoHouseholdMembersData() {
Expand Down Expand Up @@ -44,15 +45,14 @@ public void moveDataIntoHouseholdMembersData() {
"child3-person", CitizenStatusTypes.REFUGEE.name(),
"child4-person", CitizenStatusTypes.PERM_RESIDENT_OR_GREEN_CARD.name()
);
String applicantFieldName = INPUT_FIELD_NAME + DYNAMIC_FIELD_MARKER + "test-person";

citizenshipStatusMap.forEach((key, value) -> {
String fieldName = INPUT_FIELD_NAME + DYNAMIC_FIELD_MARKER + key;
submission.getInputData().put(fieldName, value);
});

// add applicant's data
submission.getInputData().put(applicantFieldName, CitizenStatusTypes.US_CITIZEN.name());
submission.getInputData().put(APPLICANT_FIELD_NAME, CitizenStatusTypes.US_CITIZEN.name());

action.run(submission);

Expand All @@ -69,6 +69,6 @@ public void moveDataIntoHouseholdMembersData() {
assertThat(member.get(HOUSEHOLD_FIELD_NAME)).isEqualTo(citizenshipStatusMap.get(uuid));
});

assertThat(submission.getInputData().get("applicantCitizenshipStatus")).isEqualTo(CitizenStatusTypes.US_CITIZEN.name());
assertThat(submission.getInputData().get(APPLICANT_FIELD_NAME)).isEqualTo(CitizenStatusTypes.US_CITIZEN.name());
}
}

0 comments on commit d25214d

Please sign in to comment.