import React from "react";
import { mount } from "enzyme";
import TabContainer from ".";
const array_items = [
{
key: "tab0",
title: "Title1",
content: (
),
},
{
key: "tab1",
title: "Title2",
content: (
),
},
{
key: "tab2",
title: "Title3",
content: (
),
},
{
key: "tab3",
title: "Title4",
content: (
),
},
{
key: "tab4",
title: "Title5",
content: (
),
},
];
describe("", () => {
it("renders without error", () => {
const wrapper = mount(
<>
>
<>
>
<>
>
),
},
]}
/>
);
expect(wrapper).toExist();
});
it("TabsContainer not re-render test", () => {
const wrapper = mount().instance();
const shouldUpdate = wrapper.shouldComponentUpdate(
wrapper.props,
wrapper.state
);
expect(shouldUpdate).toBe(false);
});
it("TabsContainer not re-render test", () => {
const wrapper = mount().instance();
const shouldUpdate = wrapper.shouldComponentUpdate(wrapper.props, {
...wrapper.state,
activeTab: 3,
});
expect(shouldUpdate).toBe(true);
});
});