Skip to content

Instantly share code, notes, and snippets.

@Keraito
Last active June 7, 2022 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keraito/54b88d72fdf82960dfc1bf07aaefcdfa to your computer and use it in GitHub Desktop.
Save Keraito/54b88d72fdf82960dfc1bf07aaefcdfa to your computer and use it in GitHub Desktop.
import { mount } from "enzyme";
import { SomeComponent, SomeComponentProps } from "./someComponent";
function mountComponent(props: Partial<SomeComponentProps>): ReactWrapper {
return mount(
<SomeComponent variant="normal" title="Test Title" {...props} />
);
}
describe("SomeComponent", () => {
test("works like it should", () => {
const onChangeMock = jest.fn();
const component = mountComponent({ onChange: onChangeMock });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment