Trying to integrate react unit testing in existing rails app. I am getting the below issue after I tried to render a component in test file
check.test.tsx :
import React from "react"; import * as ReactDOM from 'react-dom'; import { render, fireEvent,queryByAttribute ,screen,cleanup,getByText} from "@testing-library/react";
import CustomDropdown,{APIResponse} from "../CustomDropdown";
function renderCustomDropdown(props: Partial<APIResponse> = {}) {
const defaultProps: APIResponse = {
validateFormHandler() {
return;
},
items: [],
selectedItems: [],
inputText: "",
filteredsortByNameIDs: [],
placeholderText: "",
};
return render(<CustomDropdown {...defaultProps} {...props} />);
}:
Issue happens after I add render ()
ERROR in ./node_modules/@testing-library/dom/node_modules/pretty-format/build/plugins/DOMCollection.js
rails_1 | Module parse failed: Unexpected token
rails_1 | You may need an appropriate loader to handle this file type.
rails_1 | | return props;
rails_1 | | }, {})
rails_1 | | : {...collection},
rails_1 | | config,
rails_1 | | indentation,
Please help me out to fix this issue.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/uSv3GPU
Comments
Post a Comment