TypeError:无法读取未定义chai.js的属性“ find”

时间:2019-01-13 13:55:59

标签: reactjs chai-enzyme

我测试我的应用程序时遇到问题 该错误说:TypeError:无法读取未定义的属性“ find” 这是代码:

beforeAll(() => {
        wrapper = mount(<LoggedInLayout/>);
    });

    it('allows to set props', () => {
        const username = 'testUser';
        wrapper.setProps({username: username});
        expect(wrapper.props().username).to.equal(username);
    });

    it('renders all subcomponents', () => {
        expect(wrapper.find('ul.ant-menu')).to.have.lengthOf(2);
        expect(wrapper.find('.ant-menu-item')).to.have.lengthOf(3);
        expect(wrapper.find('button')).to.have.lengthOf(2);
        expect(wrapper.find('.ant-input')).to.have.lengthOf(1);
        expect(wrapper.find('.anticon')).to.have.lengthOf(2);
    });

0 个答案:

没有答案