import * as React from "react";
import { shallow, mount } from "enzyme";
import { TablePlain } from "../TablePlain";
it("should render", () => {
const sut = shallow();
expect(sut).toMatchSnapshot();
});
it("should call onRowClick if row is clicked", () => {
const handleRowClick = jest.fn();
const sut = shallow(
);
sut
.find("tbody tr")
.at(0)
.simulate("click");
expect(handleRowClick).toBeCalled();
});
describe("subComponent", () => {
it("should not call onRowClick when clicked", () => {
const handleRowClick = jest.fn();
const sut = mount(
Dummy
}
onRowClick={handleRowClick}
/>
);
sut
.find(".expander") // Click on Expander
.first()
.simulate("click");
expect(handleRowClick).not.toBeCalled();
});
});