From a496b18ac96b8bf4a208a2cc9057a4b6db08a2b0 Mon Sep 17 00:00:00 2001 From: Divyanshu Bhardwaj Date: Wed, 26 Jul 2023 11:59:45 +0530 Subject: [PATCH 1/5] Created New test case of summary-incident-mrm component --- .../component.spec.js | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js diff --git a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js new file mode 100644 index 0000000000..cf700efdc9 --- /dev/null +++ b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js @@ -0,0 +1,67 @@ +import { fromJS } from "immutable"; + +import { mountedComponent, screen } from "test-utils"; +import SubformField from "../../../record-form/form/subforms"; +import { FieldRecord, FormSectionRecord } from "../../../record-form/records"; + +import ChildrenMultipleViolations from "./component"; + +describe("", () => { + let component; + const individualVictims = [ + { + unique_id: "1234abcd", + individual_multiple_violations: true, + age: 5, + sex: "female" + }, + { + unique_id: "5678efga", + age: 4, + sex: "male" + } + ]; + const props = { + formSections: fromJS([ + FormSectionRecord({ + fields: [ + FieldRecord({ + name: "individual_victims", + subform_section_id: FormSectionRecord({}) + }) + ], + description_en: "Individual victim(s)", + unique_id: "individual_victims" + }) + ]), + recordType: "incident", + values: { + age: 10, + case_id_display: "1234abcd", + id: "1234567", + name: "Test user", + owned_by: "aa", + owned_by_agency_id: "aa", + sex: "aa", + individual_victims: individualVictims + } + }; + + beforeEach(() => { + mountedComponent(,{ values: individualVictims }); + }); + + it("should render component", () => { + expect(screen.getByText("displayDataTestId")).to.have.lengthOf(1); + }); + + xit("should render 1 component", () => { + expect(component.find(SubformField)).to.have.lengthOf(1); + }); + + xit("should render custom title", () => { + expect(component.find(SubformField).find("h3").text().trim()).to.equal( + "incidents.summary_mrm.fields.children_multiple_violation.label" + ); + }); +}); From 99e6941a75e64220f80147d52e3378955940f79a Mon Sep 17 00:00:00 2001 From: Divyanshu Bhardwaj Date: Tue, 1 Aug 2023 19:08:41 +0530 Subject: [PATCH 2/5] Created New Test cases for Summary incident mrm component --- .../component.spec.js | 18 +---- .../component.unit.test.js | 67 ------------------- ...mponent.unit.test.js => component.spec.js} | 15 ++--- ...mponent.unit.test.js => component.spec.js} | 19 ++---- .../test-utils/mounted-component.js | 2 +- 5 files changed, 14 insertions(+), 107 deletions(-) delete mode 100644 app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.unit.test.js rename app/javascript/components/summary-incident-mrm/components/summary-fields/{component.unit.test.js => component.spec.js} (57%) rename app/javascript/components/summary-incident-mrm/components/violations-subforms/{component.unit.test.js => component.spec.js} (63%) diff --git a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js index cf700efdc9..bd86dc9497 100644 --- a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js +++ b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js @@ -1,7 +1,5 @@ import { fromJS } from "immutable"; - import { mountedComponent, screen } from "test-utils"; -import SubformField from "../../../record-form/form/subforms"; import { FieldRecord, FormSectionRecord } from "../../../record-form/records"; import ChildrenMultipleViolations from "./component"; @@ -48,20 +46,10 @@ describe("", () => { }; beforeEach(() => { - mountedComponent(,{ values: individualVictims }); - }); - - it("should render component", () => { - expect(screen.getByText("displayDataTestId")).to.have.lengthOf(1); - }); - - xit("should render 1 component", () => { - expect(component.find(SubformField)).to.have.lengthOf(1); + mountedComponent(,{},{},[],{ values: individualVictims }); }); - xit("should render custom title", () => { - expect(component.find(SubformField).find("h3").text().trim()).to.equal( - "incidents.summary_mrm.fields.children_multiple_violation.label" - ); + it("should render custom title", () => { + expect(screen.getByText("incidents.summary_mrm.fields.children_multiple_violation.label")).toBeInTheDocument(); }); }); diff --git a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.unit.test.js b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.unit.test.js deleted file mode 100644 index a9f98a2675..0000000000 --- a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.unit.test.js +++ /dev/null @@ -1,67 +0,0 @@ -import { fromJS } from "immutable"; - -import { setupMountedComponent } from "../../../../test"; -import SubformField from "../../../record-form/form/subforms"; -import { FieldRecord, FormSectionRecord } from "../../../record-form/records"; - -import ChildrenMultipleViolations from "./component"; - -describe("", () => { - let component; - const individualVictims = [ - { - unique_id: "1234abcd", - individual_multiple_violations: true, - age: 5, - sex: "female" - }, - { - unique_id: "5678efga", - age: 4, - sex: "male" - } - ]; - const props = { - formSections: fromJS([ - FormSectionRecord({ - fields: [ - FieldRecord({ - name: "individual_victims", - subform_section_id: FormSectionRecord({}) - }) - ], - description_en: "Individual victim(s)", - unique_id: "individual_victims" - }) - ]), - recordType: "incident", - values: { - age: 10, - case_id_display: "1234abcd", - id: "1234567", - name: "Test user", - owned_by: "aa", - owned_by_agency_id: "aa", - sex: "aa", - individual_victims: individualVictims - } - }; - - beforeEach(() => { - ({ component } = setupMountedComponent(ChildrenMultipleViolations, props, {}, [], { values: individualVictims })); - }); - - it("should render component", () => { - expect(component.find(ChildrenMultipleViolations)).to.have.lengthOf(1); - }); - - it("should render 1 component", () => { - expect(component.find(SubformField)).to.have.lengthOf(1); - }); - - it("should render custom title", () => { - expect(component.find(SubformField).find("h3").text().trim()).to.equal( - "incidents.summary_mrm.fields.children_multiple_violation.label" - ); - }); -}); diff --git a/app/javascript/components/summary-incident-mrm/components/summary-fields/component.unit.test.js b/app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js similarity index 57% rename from app/javascript/components/summary-incident-mrm/components/summary-fields/component.unit.test.js rename to app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js index 84bfc16fcb..01eb8e54b9 100644 --- a/app/javascript/components/summary-incident-mrm/components/summary-fields/component.unit.test.js +++ b/app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js @@ -1,6 +1,6 @@ -import { setupMountedComponent } from "../../../../test"; +import { fromJS } from "immutable"; import { FormSectionField } from "../../../record-form"; - +import { mountedComponent, screen } from "test-utils"; import SummaryFields from "./component"; describe("", () => { @@ -29,15 +29,10 @@ describe("", () => { }; beforeEach(() => { - ({ component } = setupMountedComponent(SummaryFields, props, {}, [], { values })); - }); - - // TODO: Skipping for now. Causing timeout issue in cancelIdleCallback, rewrite in rtl - it.skip("should render component", () => { - expect(component.find(SummaryFields)).to.have.lengthOf(1); + mountedComponent(,{},{},[],{ values }); }); - it.skip("should render 6 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(); }); }); diff --git a/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.unit.test.js b/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js similarity index 63% rename from app/javascript/components/summary-incident-mrm/components/violations-subforms/component.unit.test.js rename to app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js index fa004c6632..7e37c55ae8 100644 --- a/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.unit.test.js +++ b/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js @@ -1,13 +1,11 @@ import { fromJS } from "immutable"; - -import { setupMountedComponent } from "../../../../test"; -import SubformField from "../../../record-form/form/subforms"; +import { mountedComponent, screen } from "test-utils"; import { FieldRecord, FormSectionRecord } from "../../../record-form/records"; import ViolationsSubforms from "./component"; describe("", () => { - let component; + const values = { age: 10, case_id_display: "1234abcd", @@ -43,19 +41,12 @@ describe("", () => { values }; + beforeEach(() => { - ({ component } = setupMountedComponent(ViolationsSubforms, props, {}, [], { values })); - }); - - it("should render component", () => { - expect(component.find(ViolationsSubforms)).to.have.lengthOf(1); - }); - - it("should render 1 component", () => { - expect(component.find(SubformField)).to.have.lengthOf(1); + mountedComponent(,{},{},[],{ 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(); }); }); diff --git a/app/javascript/test-utils/mounted-component.js b/app/javascript/test-utils/mounted-component.js index 4175d0fc87..08dfcdfcf4 100644 --- a/app/javascript/test-utils/mounted-component.js +++ b/app/javascript/test-utils/mounted-component.js @@ -52,7 +52,7 @@ function setupMountedComponent({ state, path, initialEntries, formProps } = {}) return { store, history, AppProviders }; } -function mountedComponent(Component, state = {}, options = {}, initialEntries = {}, formProps = {}, path = "") { +function mountedComponent(Component, state = {}, options = {}, initialEntries = [], formProps = {}, path = "") { const { store, history, AppProviders } = setupMountedComponent({ state, path, formProps, initialEntries }); const component = render(Component, { From 26e748873e3cecd68e8ca708df59d6a4827103f0 Mon Sep 17 00:00:00 2001 From: Divyanshu Bhardwaj Date: Mon, 7 Aug 2023 12:17:24 +0530 Subject: [PATCH 3/5] pages component test cases. --- .../components/drag-indicator/component.jsx | 2 +- .../drag-indicator/component.spec.js | 16 ++++++ .../components/filter-input/component.spec.js | 29 ++++++++++ .../filters-expansion-panel/component.jsx | 2 +- .../form-exporter/component.spec.js | 23 ++++++++ .../components/form-filters/component.spec.js | 37 +++++++++++++ .../components/form-group/component.spec.js | 39 ++++++++++++++ .../components/form-section/component.spec.js | 42 +++++++++++++++ .../components/table-row/component.spec.js | 54 +++++++++++++++++++ .../import-dialog/component.spec.js | 0 10 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js create mode 100644 app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js create mode 100644 app/javascript/components/pages/admin/forms-list/components/form-exporter/component.spec.js create mode 100644 app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js create mode 100644 app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js create mode 100644 app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js create mode 100644 app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js create mode 100644 app/javascript/components/pages/admin/locations-list/import-dialog/component.spec.js diff --git a/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.jsx b/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.jsx index 808ba38f08..df057832e2 100644 --- a/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.jsx +++ b/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.jsx @@ -8,7 +8,7 @@ const Component = ({ isDragDisabled, ...props }) => { const classes = isDragDisabled ? { classes: { root: css.dragIndicator } } : {}; return ( - + ); diff --git a/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js new file mode 100644 index 0000000000..61cf32a03f --- /dev/null +++ b/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js @@ -0,0 +1,16 @@ +import { mountedComponent, screen } from "test-utils"; + +import DragIndicator from "./component"; + +describe("/components/", () => { + let component; + + beforeEach(() => { + const props= { color: "error" }; + mountedComponent(,props); + }); + + it("renders icon", () => { + expect(screen.getByTestId('error-icon')).toBeInTheDocument(); + }); +}); diff --git a/app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js new file mode 100644 index 0000000000..51aa4c17a7 --- /dev/null +++ b/app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js @@ -0,0 +1,29 @@ +import { mountedComponent, screen } from "test-utils"; + +import FilterInput from "./component"; + +describe("/components/", () => { + + beforeEach(() => { + const state = { + id: "filter_1", + name: "Filter 1", + options: [ + { + id: "option_1", + displayName: "Option 1" + }, + { + id: "option_2", + displayName: "Option 2" + } + ], + handleSetFilterValue: () => {} + } + mountedComponent(,state); + }); + + it("renders toggle input with options", () => { + expect(screen.getByText('error-icon')).toBeInTheDocument(); + }); +}); diff --git a/app/javascript/components/pages/admin/forms-list/components/filters-expansion-panel/component.jsx b/app/javascript/components/pages/admin/forms-list/components/filters-expansion-panel/component.jsx index bbe58b2064..d0e3c00fef 100644 --- a/app/javascript/components/pages/admin/forms-list/components/filters-expansion-panel/component.jsx +++ b/app/javascript/components/pages/admin/forms-list/components/filters-expansion-panel/component.jsx @@ -6,7 +6,7 @@ import FilterInput from "../filter-input"; const Component = ({ name, handleSetFilterValue, options, id, filterValues }) => { return ( - + }>{name} /components/", () => { + const props = { + close: () => {}, + filters: {}, + i18n: { t: value => value }, + open: true, + pending: false + }; + + + + beforeEach(() => { + mountedComponent(); + }); + + it("renders ", () => { + expect(screen.getByRole('dialog')).toBeInTheDocument(); + }); +}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js new file mode 100644 index 0000000000..42de1e53ff --- /dev/null +++ b/app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js @@ -0,0 +1,37 @@ +import { mountedComponent, screen } from "test-utils"; +import { List } from "immutable"; +import FormExporter from "./component"; + +describe("/components/", () => { + const props = { + + modules: List([ + { + name: "Module 1", + unique_id: "module-1", + associated_record_types: ["record-type-1"] + }, + { + name: "Module 2", + unique_id: "module-2", + associated_record_types: ["record-type-2"] + } + ]), + handleClearValue: () => {}, + handleSetFilterValue: () => {} + + }; + + beforeEach(() => { + mountedComponent(); + }); + + it("renders clear button", () => { + expect(screen.getByText('clear')).toBeInTheDocument(); + }); + + it("renders ", () => { + expect(screen.getAllByTestId('test')).toHaveLength(2); + + }); +}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js new file mode 100644 index 0000000000..5d2a848219 --- /dev/null +++ b/app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js @@ -0,0 +1,39 @@ +import { mountedComponent, screen } from "test-utils"; +import { DragDropContext, Droppable } from "react-beautiful-dnd"; +import { Accordion, AccordionSummary, Typography } from "@material-ui/core"; + + +import DragIndicator from "../drag-indicator"; + +import FormGroup from "./component"; + +describe("/components/", () => { + + + const RenderFormGroup = () => ( + + + {provided => ( +
+ + Some Content + +
+ )} +
+
+ ); + + beforeEach(() => { + + mountedComponent(); + }); + + it("renders panel name", () => { + expect(screen.getByText("Group 1")).toBeInTheDocument(); + }); + + it("renders ", () => { + expect(screen.getByTestId("error-icon")).toBeInTheDocument(); + }); +}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js new file mode 100644 index 0000000000..abb087d378 --- /dev/null +++ b/app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js @@ -0,0 +1,42 @@ +import { mountedComponent, screen } from "test-utils"; +import { List } from "immutable"; +import { DragDropContext, Droppable } from "react-beautiful-dnd"; + +import TableRow from "../table-row"; + +import FormSection from "./component"; + +describe("/components/", () => { + + beforeEach(() => { + const group = List([ + { + name: "Section", + order: 0, + module_ids: ["module-1"], + parent_form: "form_2", + unique_id: "form_section_1", + editable: false, + id: 1 + } + ]); + + const RenderFormSection = () => ( + + + + ); + + mountedComponent(); + + }); + + it("renders ", () => { + expect(screen.getByTestId("error-icon")).toBeInTheDocument(); + }); + + it("renders ", () => { + expect(screen.getByText("form_section.form_name")).toBeInTheDocument(); + }); + +}); diff --git a/app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js new file mode 100644 index 0000000000..3d8727f68f --- /dev/null +++ b/app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js @@ -0,0 +1,54 @@ +import { mountedComponent, screen } from "test-utils"; +import { List } from "immutable"; +import { DragDropContext, Droppable } from "react-beautiful-dnd"; + +import { setupMountedComponent } from "../../../../../../test"; +import DragIndicator from "../drag-indicator"; + +import TableRow from "./component"; + +describe("/components/", () => { + + const props = { + name: "Form Section 1", + modules: [ + { + unique_id: "primeromodule-cp", + name: "CP", + associated_record_types: ["case", "tracing_request", "incident"] + } + ], + parentForm: "case", + index: 1, + uniqueID: "form", + editable: true, + id: 1 + }; + + beforeEach(() => { + const RenderTableRow = () => ( + + + {provided => ( +
+ +
+ )} +
+
+ ); + mountedComponent(); + + }); + + + + it("renders ", () => { + expect(screen.getByTestId("error-icon")).toBeInTheDocument(); + }); + + it("renders ", () => { + expect(screen.getByText("Form Section 1")).toBeInTheDocument(); + }); + +}); diff --git a/app/javascript/components/pages/admin/locations-list/import-dialog/component.spec.js b/app/javascript/components/pages/admin/locations-list/import-dialog/component.spec.js new file mode 100644 index 0000000000..e69de29bb2 From f8d64bea0b673a5a6c023f0540d54ab8f76b29cb Mon Sep 17 00:00:00 2001 From: Divyanshu Bhardwaj Date: Fri, 11 Aug 2023 14:28:24 +0530 Subject: [PATCH 4/5] Updated Summary Incident MRM component lint issues --- .../drag-indicator/component.spec.js | 16 ------ .../components/filter-input/component.spec.js | 29 ---------- .../form-exporter/component.spec.js | 23 -------- .../components/form-filters/component.spec.js | 37 ------------- .../components/form-group/component.spec.js | 39 -------------- .../components/form-section/component.spec.js | 42 --------------- .../components/table-row/component.spec.js | 54 ------------------- .../component.spec.js | 4 +- .../summary-fields/component.spec.js | 6 +-- .../violations-subforms/component.spec.js | 5 +- 10 files changed, 6 insertions(+), 249 deletions(-) delete mode 100644 app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js delete mode 100644 app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js delete mode 100644 app/javascript/components/pages/admin/forms-list/components/form-exporter/component.spec.js delete mode 100644 app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js delete mode 100644 app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js delete mode 100644 app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js delete mode 100644 app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js diff --git a/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js deleted file mode 100644 index 61cf32a03f..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/drag-indicator/component.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; - -import DragIndicator from "./component"; - -describe("/components/", () => { - let component; - - beforeEach(() => { - const props= { color: "error" }; - mountedComponent(,props); - }); - - it("renders icon", () => { - expect(screen.getByTestId('error-icon')).toBeInTheDocument(); - }); -}); diff --git a/app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js deleted file mode 100644 index 51aa4c17a7..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/filter-input/component.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; - -import FilterInput from "./component"; - -describe("/components/", () => { - - beforeEach(() => { - const state = { - id: "filter_1", - name: "Filter 1", - options: [ - { - id: "option_1", - displayName: "Option 1" - }, - { - id: "option_2", - displayName: "Option 2" - } - ], - handleSetFilterValue: () => {} - } - mountedComponent(,state); - }); - - it("renders toggle input with options", () => { - expect(screen.getByText('error-icon')).toBeInTheDocument(); - }); -}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-exporter/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-exporter/component.spec.js deleted file mode 100644 index 1492bffd91..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/form-exporter/component.spec.js +++ /dev/null @@ -1,23 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; - -import FormExporter from "./component"; - -describe("/components/", () => { - const props = { - close: () => {}, - filters: {}, - i18n: { t: value => value }, - open: true, - pending: false - }; - - - - beforeEach(() => { - mountedComponent(); - }); - - it("renders ", () => { - expect(screen.getByRole('dialog')).toBeInTheDocument(); - }); -}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js deleted file mode 100644 index 42de1e53ff..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/form-filters/component.spec.js +++ /dev/null @@ -1,37 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; -import { List } from "immutable"; -import FormExporter from "./component"; - -describe("/components/", () => { - const props = { - - modules: List([ - { - name: "Module 1", - unique_id: "module-1", - associated_record_types: ["record-type-1"] - }, - { - name: "Module 2", - unique_id: "module-2", - associated_record_types: ["record-type-2"] - } - ]), - handleClearValue: () => {}, - handleSetFilterValue: () => {} - - }; - - beforeEach(() => { - mountedComponent(); - }); - - it("renders clear button", () => { - expect(screen.getByText('clear')).toBeInTheDocument(); - }); - - it("renders ", () => { - expect(screen.getAllByTestId('test')).toHaveLength(2); - - }); -}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js deleted file mode 100644 index 5d2a848219..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/form-group/component.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; -import { DragDropContext, Droppable } from "react-beautiful-dnd"; -import { Accordion, AccordionSummary, Typography } from "@material-ui/core"; - - -import DragIndicator from "../drag-indicator"; - -import FormGroup from "./component"; - -describe("/components/", () => { - - - const RenderFormGroup = () => ( - - - {provided => ( -
- - Some Content - -
- )} -
-
- ); - - beforeEach(() => { - - mountedComponent(); - }); - - it("renders panel name", () => { - expect(screen.getByText("Group 1")).toBeInTheDocument(); - }); - - it("renders ", () => { - expect(screen.getByTestId("error-icon")).toBeInTheDocument(); - }); -}); diff --git a/app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js deleted file mode 100644 index abb087d378..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/form-section/component.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; -import { List } from "immutable"; -import { DragDropContext, Droppable } from "react-beautiful-dnd"; - -import TableRow from "../table-row"; - -import FormSection from "./component"; - -describe("/components/", () => { - - beforeEach(() => { - const group = List([ - { - name: "Section", - order: 0, - module_ids: ["module-1"], - parent_form: "form_2", - unique_id: "form_section_1", - editable: false, - id: 1 - } - ]); - - const RenderFormSection = () => ( - - - - ); - - mountedComponent(); - - }); - - it("renders ", () => { - expect(screen.getByTestId("error-icon")).toBeInTheDocument(); - }); - - it("renders ", () => { - expect(screen.getByText("form_section.form_name")).toBeInTheDocument(); - }); - -}); diff --git a/app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js b/app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js deleted file mode 100644 index 3d8727f68f..0000000000 --- a/app/javascript/components/pages/admin/forms-list/components/table-row/component.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -import { mountedComponent, screen } from "test-utils"; -import { List } from "immutable"; -import { DragDropContext, Droppable } from "react-beautiful-dnd"; - -import { setupMountedComponent } from "../../../../../../test"; -import DragIndicator from "../drag-indicator"; - -import TableRow from "./component"; - -describe("/components/", () => { - - const props = { - name: "Form Section 1", - modules: [ - { - unique_id: "primeromodule-cp", - name: "CP", - associated_record_types: ["case", "tracing_request", "incident"] - } - ], - parentForm: "case", - index: 1, - uniqueID: "form", - editable: true, - id: 1 - }; - - beforeEach(() => { - const RenderTableRow = () => ( - - - {provided => ( -
- -
- )} -
-
- ); - mountedComponent(); - - }); - - - - it("renders ", () => { - expect(screen.getByTestId("error-icon")).toBeInTheDocument(); - }); - - it("renders ", () => { - expect(screen.getByText("Form Section 1")).toBeInTheDocument(); - }); - -}); diff --git a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js index bd86dc9497..2f44e4b933 100644 --- a/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js +++ b/app/javascript/components/summary-incident-mrm/components/children-multiple-violations/component.spec.js @@ -1,11 +1,11 @@ import { fromJS } from "immutable"; import { mountedComponent, screen } from "test-utils"; + import { FieldRecord, FormSectionRecord } from "../../../record-form/records"; import ChildrenMultipleViolations from "./component"; describe("", () => { - let component; const individualVictims = [ { unique_id: "1234abcd", @@ -46,7 +46,7 @@ describe("", () => { }; beforeEach(() => { - mountedComponent(,{},{},[],{ values: individualVictims }); + mountedComponent(, {}, {}, [], { values: individualVictims }); }); it("should render custom title", () => { diff --git a/app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js b/app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js index 01eb8e54b9..e2b1864d89 100644 --- a/app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js +++ b/app/javascript/components/summary-incident-mrm/components/summary-fields/component.spec.js @@ -1,10 +1,8 @@ -import { fromJS } from "immutable"; -import { FormSectionField } from "../../../record-form"; import { mountedComponent, screen } from "test-utils"; + import SummaryFields from "./component"; describe("", () => { - let component; const values = { age: 10, case_id_display: "1234abcd", @@ -29,7 +27,7 @@ describe("", () => { }; beforeEach(() => { - mountedComponent(,{},{},[],{ values }); + mountedComponent(, {}, {}, [], { values }); }); it("should render custom title", () => { diff --git a/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js b/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js index 7e37c55ae8..01873a7205 100644 --- a/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js +++ b/app/javascript/components/summary-incident-mrm/components/violations-subforms/component.spec.js @@ -1,11 +1,11 @@ import { fromJS } from "immutable"; import { mountedComponent, screen } from "test-utils"; + import { FieldRecord, FormSectionRecord } from "../../../record-form/records"; import ViolationsSubforms from "./component"; describe("", () => { - const values = { age: 10, case_id_display: "1234abcd", @@ -41,9 +41,8 @@ describe("", () => { values }; - beforeEach(() => { - mountedComponent(,{},{},[],{ values }); + mountedComponent(, {}, {}, [], { values }); }); it("should render custom title", () => { From 22513cd810e7cff25481250ad022212653845ef1 Mon Sep 17 00:00:00 2001 From: Divyanshu Bhardwaj Date: Fri, 11 Aug 2023 14:32:53 +0530 Subject: [PATCH 5/5] Updated Summary Incident MRM component remove blank file --- .../pages/admin/locations-list/import-dialog/component.spec.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/javascript/components/pages/admin/locations-list/import-dialog/component.spec.js diff --git a/app/javascript/components/pages/admin/locations-list/import-dialog/component.spec.js b/app/javascript/components/pages/admin/locations-list/import-dialog/component.spec.js deleted file mode 100644 index e69de29bb2..0000000000