Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
johanna-skylight committed Sep 27, 2023
2 parents 0115469 + 26b850b commit 1209f06
Show file tree
Hide file tree
Showing 18 changed files with 2,206 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void getDiseaseCacheWhenCachePopulated_successful() {
Map<UUID, SupportedDisease> serviceMap = _service.getKnownSupportedDiseasesMap();
List<SupportedDisease> repoList = repo.findAll();

assertThat(serviceMap).isNotNull().hasSize(4);
assertThat(serviceMap).isNotNull().isNotEmpty();

repoList.forEach(
d -> {
Expand All @@ -50,7 +50,7 @@ void getDiseaseCacheWhenCacheNotPopulated_successful() {
Map<UUID, SupportedDisease> serviceMap = _service.getKnownSupportedDiseasesMap();
List<SupportedDisease> repoList = repo.findAll();

assertThat(serviceMap).isNotNull().hasSize(4);
assertThat(serviceMap).isNotNull().isNotEmpty();

repoList.forEach(
d -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void getSupportedDiseasesMap_successful() {

assertThat(supportedDiseasesMap)
.isNotNull()
.hasSize(4)
.isNotEmpty()
.containsEntry(_service.covid().getInternalId(), _service.covid())
.containsEntry(_service.fluA().getInternalId(), _service.fluA())
.containsEntry(_service.fluB().getInternalId(), _service.fluB())
Expand All @@ -86,7 +86,7 @@ void getSupportedDiseasesList_successful() {

assertThat(supportedDiseasesList)
.isNotNull()
.hasSize(4)
.isNotEmpty()
.contains(_service.covid())
.contains(_service.fluA())
.contains(_service.fluB())
Expand Down
2 changes: 1 addition & 1 deletion cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@faker-js/faker": "^8.0.2",
"cypress": "^11.0.0",
"cypress-localstorage-commands": "^2.2.4",
"dayjs": "^1.11.9",
"dayjs": "^1.11.10",
"eslint": "^8.50.0",
"eslint-plugin-cypress": "^2.14.0",
"otplib": "^12.0.1",
Expand Down
13 changes: 4 additions & 9 deletions cypress/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,10 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"

dayjs@^1.10.4:
version "1.11.0"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.0.tgz#009bf7ef2e2ea2d5db2e6583d2d39a4b5061e805"
integrity sha512-JLC809s6Y948/FuCZPm5IX8rRhQwOiyMb2TfVVQEixG7P8Lm/gt5S7yoQZmC8x1UehI9Pb7sksEt4xx14m+7Ug==

dayjs@^1.11.9:
version "1.11.9"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.9.tgz#9ca491933fadd0a60a2c19f6c237c03517d71d1a"
integrity sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==
dayjs@^1.10.4, dayjs@^1.11.10:
version "1.11.10"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0"
integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==

debug@^3.1.0:
version "3.2.7"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/constants/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ interface PersonUpdate extends Address {
country: string;
emails: string[];
preferredLanguage: Language | null;
notes: string | null;
testResultDelivery: TestResultDeliveryPreference | null;
}

Expand Down
3 changes: 3 additions & 0 deletions frontend/src/app/patients/AddPatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const EMPTY_PERSON: Nullable<PersonFormData> = {
country: "USA",
preferredLanguage: null,
testResultDelivery: null,
notes: null,
};

export const PATIENT_EXISTS = gql`
Expand Down Expand Up @@ -98,6 +99,7 @@ export const ADD_PATIENT = gql`
$employedInHealthcare: Boolean
$preferredLanguage: String
$testResultDelivery: TestResultDeliveryPreference
$notes: String
) {
addPatient(
facilityId: $facilityId
Expand Down Expand Up @@ -125,6 +127,7 @@ export const ADD_PATIENT = gql`
employedInHealthcare: $employedInHealthcare
preferredLanguage: $preferredLanguage
testResultDelivery: $testResultDelivery
notes: $notes
) {
internalId
facility {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe("Add Patient: All required fields entered and submitting address verifi
"Email address": "[email protected]",
"Street address 1": "25 Shattuck St",
City: "Boston",

"ZIP code": "02115",
Notes: "Green tent",
},
{ Facility: mockFacilityID, State: "MA", Country: "USA" },
{
Expand Down Expand Up @@ -155,7 +155,6 @@ describe("Add Patient: All required fields entered and submitting address verifi
"Email address": "[email protected]",
"Street address 1": "25 Shattuck St",
City: "Boston",

"ZIP code": "02115",
},
{ Facility: mockFacilityID, State: "MA", Country: "USA" },
Expand Down
178 changes: 178 additions & 0 deletions frontend/src/app/patients/AddPatientStartsTest.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
import { screen, waitFor, within } from "@testing-library/react";
import * as router from "react-router";

import * as smartyStreets from "../utils/smartyStreets";

import {
fillOutForm,
mockFacilityID,
renderWithUserWithFacility,
} from "./AddPatientTestUtils";

describe("Add Patient: saving changes and starting a test", () => {
const mockNavigate = jest.fn();
beforeEach(async () => {
jest.spyOn(smartyStreets, "getBestSuggestion").mockImplementation();
jest.spyOn(smartyStreets, "suggestionIsCloseEnough").mockReturnValue(false);
jest.spyOn(smartyStreets, "getZipCodeData").mockResolvedValue(undefined);

jest.spyOn(router, "useNavigate").mockImplementation(() => mockNavigate);
});

it("redirects to the queue after address validation", async () => {
jest.spyOn(smartyStreets, "suggestionIsCloseEnough").mockReturnValue(true);
const { user } = renderWithUserWithFacility();
await fillOutForm(
{
"First Name": "Alice",
"Last Name": "Hamilton",
"Date of birth": "1970-09-22",
"Primary phone number": "617-432-1000",
"Email address": "[email protected]",
"Street address 1": "25 Shattuck St",
City: "Boston",
"ZIP code": "02115",
notes: "Green tent",
},
{ Facility: mockFacilityID, State: "MA", Country: "USA" },
{
"Phone type": {
label: "Mobile",
value: "MOBILE",
exact: true,
},
"Would you like to receive your results via text message?": {
label: "Yes",
value: "SMS",
exact: false,
},
Race: {
label: "Other",
value: "other",
exact: true,
},
"Are you Hispanic or Latino?": {
label: "Prefer not to answer",
value: "refused",
exact: true,
},
"Sex assigned at birth": {
label: "Female",
value: "female",
exact: true,
},
"What's your gender identity?": {
label: "Female",
value: "female",
exact: true,
},
}
);

await user.click(
screen.queryAllByText("Save and start test", {
exact: false,
})[0]
);

expect(
screen.queryByText("Address validation", {
exact: false,
})
).not.toBeInTheDocument();

await waitFor(() =>
expect(mockNavigate).toHaveBeenCalledWith(
"/queue?facility=facility-id-001",
{
state: {
patientId: "153f661f-b6ea-4711-b9ab-487b95198cce",
},
}
)
);
});

it("redirects to the queue with a patient id and selected facility id", async () => {
const { user } = renderWithUserWithFacility();
await fillOutForm(
{
"First Name": "Alice",
"Last Name": "Hamilton",
"Date of birth": "1970-09-22",
"Primary phone number": "617-432-1000",
"Email address": "[email protected]",
"Street address 1": "25 Shattuck St",
City: "Boston",
"ZIP code": "02115",
notes: "Green tent",
},
{ Facility: mockFacilityID, State: "MA", Country: "USA" },
{
"Phone type": {
label: "Mobile",
value: "MOBILE",
exact: true,
},
"Would you like to receive your results via text message?": {
label: "Yes",
value: "SMS",
exact: false,
},
Race: {
label: "Other",
value: "other",
exact: true,
},
"Are you Hispanic or Latino?": {
label: "Prefer not to answer",
value: "refused",
exact: true,
},
"Sex assigned at birth": {
label: "Female",
value: "female",
exact: true,
},
"What's your gender identity?": {
label: "Female",
value: "female",
exact: true,
},
}
);
await user.click(
screen.queryAllByText("Save and start test", {
exact: false,
})[0]
);
expect(
await screen.findByText("Address validation", {
exact: false,
})
).toBeInTheDocument();

const modal = screen.getByRole("dialog");

await user.click(
within(modal).getByLabelText("Use address as entered", {
exact: false,
})
);
await user.click(
within(modal).getByText("Save changes", {
exact: false,
})
);
await waitFor(() =>
expect(mockNavigate).toHaveBeenCalledWith(
"/queue?facility=facility-id-001",
{
state: {
patientId: "153f661f-b6ea-4711-b9ab-487b95198cce",
},
}
)
);
});
});
1 change: 1 addition & 0 deletions frontend/src/app/patients/AddPatientTestUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const addPatientRequestParams = {
city: "Boston",
state: "MA",
zipCode: "02115",
notes: "Green tent",
country: "USA",
telephone: null,
phoneNumbers: [
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/patients/Components/ManageEmails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const patient = {
testResultDelivery: null,
preferredLanguage: null,
tribalAffiliation: null,
notes: null,
};

function ManageEmailsContainer() {
Expand Down
22 changes: 21 additions & 1 deletion frontend/src/app/patients/Components/PersonForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useState, useEffect, useRef } from "react";
import { SchemaOf } from "yup";
import { useTranslation } from "react-i18next";
import { ComboBox } from "@trussworks/react-uswds";
import { ComboBox, Label, Textarea } from "@trussworks/react-uswds";

import {
canadianProvinceCodes,
Expand Down Expand Up @@ -611,6 +611,26 @@ const PersonForm = (props: Props) => {
</div>
) : null}
</div>
<div className="usa-form" style={{ maxWidth: "30rem" }}>
<div className="usa-form-group">
<Label htmlFor="patient-notes-textarea">
{t("patient.form.notes.heading")}
</Label>
<span id="with-hint-textarea-hint" className="usa-hint">
{t("patient.form.notes.helpText")}
</span>
<Textarea
id="patient-notes-textarea"
maxLength={10000}
aria-describedby="with-hint-textarea-info with-hint-textarea-hint"
onChange={(value) => {
onPersonChange("notes")(value.target.value);
}}
name="notes"
value={patient.notes || undefined}
/>
</div>
</div>
</FormGroup>
<FormGroup title={t("patient.form.demographics.heading")}>
<p className="usa-hint maxw-prose">
Expand Down
Loading

0 comments on commit 1209f06

Please sign in to comment.