/**
 * TEAM: frontend_infra
 * @flow
 */

import * as React from "react";
// TODO: Fix this eslint issue on next edit. This is an autogenerated comment.
// eslint-disable-next-line flexport/no-legacy-dependencies
import {mount} from "enzyme";

import SideNav from "../SideNav";

function mountSideNav(props?: $Shape<React.ElementConfig<typeof SideNav>>) {
  return mount(
    <SideNav title="title" pathname={window.location.pathname} {...props}>
      <SideNav.Item href="/" iconName="shipment" notificationCount={21}>
        New
      </SideNav.Item>
      <SideNav.Item href="/" iconName="calendar" notificationCount={0}>
        Plan
      </SideNav.Item>
    </SideNav>
  );
}

describe("SideNav", () => {
  it("shows the right number of nav items", () => {
    const wrapper = mountSideNav();
    const navItems = wrapper.find(SideNav.Item);

    expect(navItems.length).toBe(2);
  });
});
