import React from 'react';
import Enzyme, {mount, shallow} from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { renderHook, act } from '@testing-library/react-hooks';
import {YRoute} from './route';
import { RouterProvider } from './provider';
import {transformToHistoryState} from './utils';
import { useHistory } from './useHistory';

Enzyme.configure({adapter: new Adapter()});

describe('验证路由组件', () => {

  it('注册完路由后， 所有页面都隐藏', () => {
    const Wraper = () => (
      <RouterProvider>
        <YRoute path="/" title="桌面">
          <div>Page1 桌面</div>
        </YRoute>
        <YRoute path="/moduleList" title="云中台">
          <div>Page2 云中台</div>
        </YRoute>
        <YRoute path="/:moduleName/:moduleId/:menu?" title="遥望云">
          <YRoute path="/goodsManagecategoryManage" title="类目管理" isDefault={true}>
            <div>Page3 类目管理</div>
          </YRoute>
        </YRoute>
      </RouterProvider>
    )
    const {result} = renderHook(() => useHistory(), {wrapper: Wraper });

    console.log('result', result.current)

    // const  Pages = mount(<Wraper />);

    // Pages.find('.disable').forEach((node) => {
    //   expect(node.text()).toBe('是否隐藏：是');
    // });
    // Pages.find('.hasShowed').forEach((node) => {
    //   expect(node.text()).toBe('是否要渲染组件：否');
    // });
  });

});
