diff --git a/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.js b/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.js index ee011ced..6e0b01ff 100644 --- a/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.js +++ b/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.js @@ -148,7 +148,13 @@ export default function ApplicationForm({ loader: { width: "100%", textAlign: "center", display: "inline-block" }, content: { display: "none" } }); - + // Create a gender text Map + const genderTxtMap = new Map([ + ["female", "F"], + ["male", "M"], + ["diverse", "U"], + ["unknown", "U"] + ]); const location = useLocation(); const getAge = birthdateString => { @@ -228,7 +234,7 @@ export default function ApplicationForm({ } // Convert gender text - const formatGender = gender === "female" ? "F" : "M"; + const formatGender = genderTxtMap.get(gender.toLowerCase()); const age = getAge(birthdate); diff --git a/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.test.js b/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.test.js index 2c261125..0042ea93 100644 --- a/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.test.js +++ b/src/ecrc-frontend/src/components/page/applicationForm/ApplicationForm.test.js @@ -193,6 +193,88 @@ describe("ApplicationForm Component", () => { expect(asFragment()).toMatchSnapshot(); }); + test("Matches the snapshot with gender being diverse", async () => { + const newApplicant = { + ...applicant, + genderTxt: "Diverse" + }; + + const newPage = { + ...page, + applicant: newApplicant + }; + + const updatePayload = { + userInfo: { + birthdate: "04/04/04", + address: { + street_address: "123 addy", + locality: "local", + region: "British Columbia", + postal_code: "v9n1d4" + }, + gender: "U", + given_name: "given", + given_names: "givens", + family_name: "fam", + identity_assurance_level: 3 + }, + authorities: ["Authorized"] + }; + const token = generateJWTToken(updatePayload); + + mock.onGet(API_REQUEST_JWT).reply(200, token); + + const { asFragment } = render( + + + + ); + + expect(asFragment()).toMatchSnapshot(); + }); + + test("Matches the snapshot with gender being unknown", async () => { + const newApplicant = { + ...applicant, + genderTxt: "Unknown" + }; + + const newPage = { + ...page, + applicant: newApplicant + }; + + const updatePayload = { + userInfo: { + birthdate: "04/04/04", + address: { + street_address: "123 addy", + locality: "local", + region: "British Columbia", + postal_code: "v9n1d4" + }, + gender: "U", + given_name: "given", + given_names: "givens", + family_name: "fam", + identity_assurance_level: 3 + }, + authorities: ["Authorized"] + }; + const token = generateJWTToken(updatePayload); + + mock.onGet(API_REQUEST_JWT).reply(200, token); + + const { asFragment } = render( + + + + ); + + expect(asFragment()).toMatchSnapshot(); + }); + test("Matches the snapshot with valid region/province", async () => { const updatePayload = { userInfo: { diff --git a/src/ecrc-frontend/src/components/page/applicationForm/__snapshots__/ApplicationForm.test.js.snap b/src/ecrc-frontend/src/components/page/applicationForm/__snapshots__/ApplicationForm.test.js.snap index 53b5436e..9c3db424 100644 --- a/src/ecrc-frontend/src/components/page/applicationForm/__snapshots__/ApplicationForm.test.js.snap +++ b/src/ecrc-frontend/src/components/page/applicationForm/__snapshots__/ApplicationForm.test.js.snap @@ -1308,6 +1308,1314 @@ exports[`ApplicationForm Component Matches the snapshot 1`] = ` `; +exports[`ApplicationForm Component Matches the snapshot with gender being diverse 1`] = ` + +
+
+
+ +
+
+
+

+ Criminal Record Check - Application +

+

+ Complete the application form below to continue. +

+
+
+
+
+
+ Loading... Please Wait +
+
+
+
+ PERSONAL INFORMATION +
+
    +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
+
+
+ + PREVIOUS NAME  + + + - Including birth name, previous name, maiden name, and/or alias + +
+
+
+
    +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
+
+
+ + If you have more than one previous name, please  + + +
+
+
+
+
+
    +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
+
+
+
+
+
+
+
+
+
+
+ Position Information +
+
    +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
+
+
+
+
+
+ + Addresses + +
+
+ + Current Residential Address + +
+
+
    +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
+
+

+ Is your current mailing address the same as your current residential address?  +

+
+ + Yes  + + + +  No  + + +
+
+
+ + Current Mailing Address + +
+
+
+
+
+
+
+
    +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
+
+
+
+
+
+
+
+
+ Entering your mailing address in this application will not update your BC Services Card Address. To update your BC Services Card information you must contact  + + Service BC + + ,  + + ICBC + +  or  + + AddressChangeBC + + . +
+
+ + +
+
+
+
+
+
+
+
+
+

+

+

+
+
+
+ + + +
+
+ Update your BC Services Card Information +
+
+
+

+
+ + If you find an error with your: +
    +
  • + First Name +
  • +
  • + Middle Name +
  • +
  • + Last Name +
  • +
  • + Date Of Birth +
  • +
  • + Sex +
  • +
  • + Current Street Address +
  • +
+ Please visit the + + BC Services Card website + + to change your personal information +
+
+
+
+
+
+
+
+
+
+
+

+

+

+ Collection Notice +

+
+ +
+ The Security Programs Division will collect your personal information for the purpose of fulfilling the criminal record check requirements of the Criminal Records Review Act and in accordance with section 26(c) of the Freedom of Information and Protection of Privacy Act (FoIPPA). Additionally, SPD may collect personal information under section 26(e) of FoIPPA for the purpose of evaluating the Criminal Records Review Program and activities to better serve you. Should you have any questions about the collection, use, or disclosure of your personal information, please contact the Policy Analyst of the Criminal Records Review Program, Security Programs Division via mail to PO Box 9217 Stn Prov Govt Victoria, BC V8W 9J1; email to  + + criminalrecords@gov.bc.ca + +  or by telephone at 1- 855-587-0185 (option 2). +
+
+
+
+
+
+
+
+
+
+
+ +
+
+`; + exports[`ApplicationForm Component Matches the snapshot with gender being female 1`] = `
@@ -1681,7 +2989,1315 @@ exports[`ApplicationForm Component Matches the snapshot with gender being female id="genderTxt" readonly="" type="text" - value="Female" + value="Female" + /> +
+ + + +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • +
  • +
    + + +
    + +
    +
  • + + + + + + +
    +
    +
    +
    +
    + Position Information +
    +
      +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    +
    +
    +
    +
    +
    + + Addresses + +
    +
    + + Current Residential Address + +
    +
    +
      +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    +
    +

    + Is your current mailing address the same as your current residential address?  +

    +
    + + Yes  + + + +  No  + + +
    +
    +
    + + Current Mailing Address + +
    +
    +
    +
    +
    +
    +
    +
      +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    +
    +
    +
    +
    +
    +
    +
    +
    + Entering your mailing address in this application will not update your BC Services Card Address. To update your BC Services Card information you must contact  + + Service BC + + ,  + + ICBC + +  or  + + AddressChangeBC + + . +
    +
    + + +
    + + +
    +
    +
    +
    +
    +
    +

    +

    +

    +
    +
    +
    + + + +
    +
    + Update your BC Services Card Information +
    +
    +
    +

    +
    + + If you find an error with your: +
      +
    • + First Name +
    • +
    • + Middle Name +
    • +
    • + Last Name +
    • +
    • + Date Of Birth +
    • +
    • + Sex +
    • +
    • + Current Street Address +
    • +
    + Please visit the + + BC Services Card website + + to change your personal information +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    +

    +

    + Collection Notice +

    +
    + +
    + The Security Programs Division will collect your personal information for the purpose of fulfilling the criminal record check requirements of the Criminal Records Review Act and in accordance with section 26(c) of the Freedom of Information and Protection of Privacy Act (FoIPPA). Additionally, SPD may collect personal information under section 26(e) of FoIPPA for the purpose of evaluating the Criminal Records Review Program and activities to better serve you. Should you have any questions about the collection, use, or disclosure of your personal information, please contact the Policy Analyst of the Criminal Records Review Program, Security Programs Division via mail to PO Box 9217 Stn Prov Govt Victoria, BC V8W 9J1; email to  + + criminalrecords@gov.bc.ca + +  or by telephone at 1- 855-587-0185 (option 2). +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +`; + +exports[`ApplicationForm Component Matches the snapshot with gender being unknown 1`] = ` + +
    +
    +
    + +
    +
    +
    +

    + Criminal Record Check - Application +

    +

    + Complete the application form below to continue. +

    +
    +
    +
    +
    +
    + Loading... Please Wait +
    +
    +
    +
    + PERSONAL INFORMATION +
    +
      +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    +
    +
    + + PREVIOUS NAME  + + + - Including birth name, previous name, maiden name, and/or alias + +
    +
    +
    +
      +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    +
    +
    + + If you have more than one previous name, please  + + +
    +
    +
    +
    +
    +
      +
    • +
      + + +
      + +
      +
    • +
    • +
      + + +
      + +
      +
    • +
    • +
      + +