Skip to content

Commit 21dbd33

Browse files
Merge pull request #457 from primeroIMS/trigyn-testcases-record-actions-transitions-components-referrals
Trigyn testcases record actions transitions components referrals
2 parents b363569 + 1bc0b2c commit 21dbd33

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

app/javascript/components/record-actions/transitions/components/referrals/component.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { fromJS } from "immutable";
44

5-
import { mountedComponent, screen, cleanup } from "../../../../../test-utils";
5+
import { mountedComponent, screen } from "../../../../../test-utils";
66
import users from "../../mocked-users";
77

88
import ReferralForm from "./component";

app/javascript/components/record-actions/transitions/components/referrals/form-internal.spec.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { mountedComponent, screen } from "../../../../../test-utils";
55

66
import FormInternal from "./form-internal";
77

8-
const InternalForm = props => {
8+
function InternalForm(props) {
99
const formProps = {
1010
initialValues: {
1111
agency: "",
@@ -21,7 +21,8 @@ const InternalForm = props => {
2121
</Form>
2222
</Formik>
2323
);
24-
};
24+
}
25+
InternalForm.displayName = "InternalForm";
2526

2627
describe("<FormInternal />", () => {
2728
const props = {
@@ -56,11 +57,6 @@ describe("<FormInternal />", () => {
5657

5758
it("renders Field", () => {
5859
mountedComponent(<InternalForm {...props} />);
59-
expect(screen.queryAllByRole("textbox")).toHaveLength(3);
60-
});
61-
62-
it("renders TextFieldProps from SearchableSelect with valid props", () => {
63-
mountedComponent(<InternalForm {...props} />);
64-
expect(screen.queryAllByRole("textbox")).toHaveLength(3);
60+
expect(document.querySelectorAll("input")).toHaveLength(3);
6561
});
6662
});

app/javascript/components/record-actions/transitions/components/referrals/provided-consent.spec.js

-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable no-unused-expressions */
22
import { mountedComponent, screen } from "../../../../../test-utils";
3-
import { RECORD_TYPES } from "../../../../../config";
43

54
import ProvidedConsent from "./provided-consent";
65

@@ -53,15 +52,4 @@ describe("<ProvidedConsent /> - referrals", () => {
5352
expect(screen.getByText(/referral.provided_consent_label/i)).toBeInTheDocument();
5453
});
5554

56-
it("should render <ProvidedForm> with valid props", () => {
57-
const props = {
58-
canConsentOverride: true,
59-
providedConsent: false,
60-
setDisabled: () => {},
61-
recordType: RECORD_TYPES.cases
62-
};
63-
64-
mountedComponent(<ProvidedConsent {...props} />, {}, [], [], formProps);
65-
expect(screen.queryAllByTestId("form-control")).toHaveLength(1);
66-
});
6755
});

app/javascript/components/record-actions/transitions/components/referrals/provided-form.spec.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ describe("<ProvidedForm /> - referrals", () => {
2424
});
2525

2626
it("should render some components when user can not override consent", () => {
27-
const props = {
27+
const canNotOverrideProps = {
2828
canConsentOverride: false
2929
};
3030

31-
mountedComponent(<ProvidedForm {...props} />, {}, [], [], formProps);
32-
31+
mountedComponent(<ProvidedForm {...canNotOverrideProps} />, {}, [], [], formProps);
3332
expect(screen.queryAllByTestId("grid")).toHaveLength(3);
3433
expect(screen.queryByTestId("form-control")).toBeNull();
34+
expect(screen.queryAllByRole("checkbox")).toHaveLength(0);
3535
expect(screen.getByText(/referral.provided_consent_label/i)).toBeInTheDocument();
36+
3637
});
3738
});

0 commit comments

Comments
 (0)