Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 酶与环境反应的检测_Javascript_Reactjs_Testing_Mocha.js_Enzyme - Fatal编程技术网

Javascript 酶与环境反应的检测

Javascript 酶与环境反应的检测,javascript,reactjs,testing,mocha.js,enzyme,Javascript,Reactjs,Testing,Mocha.js,Enzyme,在酶测试套件中测试使用Context.Consumer的React组件时运气不佳 侧包装器组件: const SidebarWrapper = props => ( <SidebarContext.Consumer> {({ sidebar: { Component, isOpen, close } }) => ( <OnOutsideClick onClick={event =&g

在酶测试套件中测试使用Context.Consumer的React组件时运气不佳

侧包装器组件:

      const SidebarWrapper = props => (
      <SidebarContext.Consumer>
        {({ sidebar: { Component, isOpen, close } }) => (
          <OnOutsideClick
            onClick={event => {
              /* this class is added to hamburger menu to avoid opening + closing at the same time */
              if (!event.target.className.includes("override-outside-click")) {
                close();
              }
            }}
          >
            <div className={classNames("sidebar", { "sidebar--open": isOpen })}>
              <Component />
            </div>
          </OnOutsideClick>
        )}
      </SidebarContext.Consumer>
    );
你知道怎么让它工作吗

        describe("<SidebarWrapper />", () => {
        it("test", () => {
            const app = mount
            (
                <SidebarWrapper />
            );
            expect(app.find(".sidebar"));
        });
        });
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"react": "^16.8.4",
"react-dom": "^16.8.4"