import React from "react";
import Adapter from "enzyme-adapter-react-16";
import { configure, shallow, mount } from "enzyme";
import Banking, { BankingForm } from './Banking';
configure({ adapter: new Adapter() });
describe('FormikHandlers', () => {
describe('handleChange', () => {
it('change value for firstBankName', async () => {
const component = shallow(<Banking />);
expect(component.find(BankingForm)).toHaveLength(1);
});
});
});
在这里,我将 Banking 作为父组件,将 bankingForm 作为具有所有字段的子组件。我在 Baking 父组件中使用 formik 渲染道具。此测试失败,因为当它被浅渲染时,我无法在组件内部获取“BankingForm”组件。我做错了什么酶的观点吗?