diff --git a/src/components/forms/__tests__/company-form.test.js b/src/components/forms/__tests__/company-form.test.js new file mode 100644 index 000000000..ed1dcc90d --- /dev/null +++ b/src/components/forms/__tests__/company-form.test.js @@ -0,0 +1,357 @@ +// ---- Mocks must come first ---- + +jest.mock("i18n-react/dist/i18n-react", () => ({ + __esModule: true, + default: { translate: (key) => key } +})); + +jest.mock("openstack-uicore-foundation/lib/utils/query-actions", () => ({ + getCountryList: jest.fn((callback) => { + callback([ + { iso_code: "AR", name: "Argentina" }, + { iso_code: "US", name: "United States" } + ]); + return Promise.resolve(); + }) +})); + +jest.mock( + "openstack-uicore-foundation/lib/components/inputs/upload-input-v3", + () => ({ + __esModule: true, + default: ({ id, onUploadComplete, onUploadStart, value }) => ( +
+ +
+ ) + }) +); + +jest.mock( + "openstack-uicore-foundation/lib/components/mui/formik-inputs/textfield", + () => + function MockTextField({ name }) { + return ; + } +); + +jest.mock( + "openstack-uicore-foundation/lib/components/mui/formik-inputs/select", + () => + function MockSelect({ name, children }) { + return
{children}
; + } +); + +jest.mock( + "openstack-uicore-foundation/lib/components/mui/table", + () => + // eslint-disable-next-line react/prop-types + function MockTable({ data, onDelete }) { + return ( +
+ {data.map((row) => ( + + ))} +
+ ); + } +); + +jest.mock( + "../../inputs/formik-text-editor", + () => + function MockTextEditor({ name }) { + return