Skip to content

Commit

Permalink
Merge pull request #243 from ajit3190/trigyn-testcase-summary-inciden…
Browse files Browse the repository at this point in the history
…t-mrm

Trigyn testcase summary incident mrm
  • Loading branch information
jtoliver-quoin authored Aug 21, 2023
2 parents 838a5a0 + 22513cd commit ab5ed27
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Component = ({ isDragDisabled, ...props }) => {
const classes = isDragDisabled ? { classes: { root: css.dragIndicator } } : {};

return (
<Icon {...props} {...classes}>
<Icon {...props} {...classes} data-testid="error-icon">
<DragIndicatorIcon />
</Icon>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FilterInput from "../filter-input";

const Component = ({ name, handleSetFilterValue, options, id, filterValues }) => {
return (
<Accordion elevation={3} defaultExpanded>
<Accordion elevation={3} defaultExpanded data-testid="test">
<AccordionSummary expandIcon={<ExpandMoreIcon />}>{name}</AccordionSummary>
<AccordionDetails>
<FilterInput
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { fromJS } from "immutable";
import { mountedComponent, screen } from "test-utils";

import { setupMountedComponent } from "../../../../test";
import SubformField from "../../../record-form/form/subforms";
import { FieldRecord, FormSectionRecord } from "../../../record-form/records";

import ChildrenMultipleViolations from "./component";

describe("<ChildrenMultipleViolations />", () => {
let component;
const individualVictims = [
{
unique_id: "1234abcd",
Expand Down Expand Up @@ -48,20 +46,10 @@ describe("<ChildrenMultipleViolations />", () => {
};

beforeEach(() => {
({ component } = setupMountedComponent(ChildrenMultipleViolations, props, {}, [], { values: individualVictims }));
});

it("should render <ChildrenMultipleViolations /> component", () => {
expect(component.find(ChildrenMultipleViolations)).to.have.lengthOf(1);
});

it("should render 1 <SubformField /> component", () => {
expect(component.find(SubformField)).to.have.lengthOf(1);
mountedComponent(<ChildrenMultipleViolations {...props} />, {}, {}, [], { values: individualVictims });
});

it("should render custom title", () => {
expect(component.find(SubformField).find("h3").text().trim()).to.equal(
"incidents.summary_mrm.fields.children_multiple_violation.label"
);
expect(screen.getByText("incidents.summary_mrm.fields.children_multiple_violation.label")).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { setupMountedComponent } from "../../../../test";
import { FormSectionField } from "../../../record-form";
import { mountedComponent, screen } from "test-utils";

import SummaryFields from "./component";

describe("<SummaryFields />", () => {
let component;
const values = {
age: 10,
case_id_display: "1234abcd",
Expand All @@ -29,15 +27,10 @@ describe("<SummaryFields />", () => {
};

beforeEach(() => {
({ component } = setupMountedComponent(SummaryFields, props, {}, [], { values }));
mountedComponent(<SummaryFields {...props} />, {}, {}, [], { values });
});

// TODO: Skipping for now. Causing timeout issue in cancelIdleCallback, rewrite in rtl
it.skip("should render <SummaryFields /> component", () => {
expect(component.find(SummaryFields)).to.have.lengthOf(1);
});

it.skip("should render 6 <FormSectionField /> component", () => {
expect(component.find(FormSectionField)).to.have.lengthOf(6);
it("should render custom title", () => {
expect(screen.getByText("incidents.summary_mrm.fields.summary_of_incident.label")).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { fromJS } from "immutable";
import { mountedComponent, screen } from "test-utils";

import { setupMountedComponent } from "../../../../test";
import SubformField from "../../../record-form/form/subforms";
import { FieldRecord, FormSectionRecord } from "../../../record-form/records";

import ViolationsSubforms from "./component";

describe("<ViolationsSubforms />", () => {
let component;
const values = {
age: 10,
case_id_display: "1234abcd",
Expand Down Expand Up @@ -44,18 +42,10 @@ describe("<ViolationsSubforms />", () => {
};

beforeEach(() => {
({ component } = setupMountedComponent(ViolationsSubforms, props, {}, [], { values }));
});

it("should render <ViolationsSubforms /> component", () => {
expect(component.find(ViolationsSubforms)).to.have.lengthOf(1);
});

it("should render 1 <SubformField /> component", () => {
expect(component.find(SubformField)).to.have.lengthOf(1);
mountedComponent(<ViolationsSubforms {...props} />, {}, {}, [], { values });
});

it("should render custom title", () => {
expect(component.find(SubformField).find("h3").text().trim()).to.equal("Killing of Children");
expect(screen.getByText("Killing of Children")).toBeInTheDocument();
});
});

0 comments on commit ab5ed27

Please sign in to comment.