Unit testing 从异步函数测试react组件

Unit testing 从异步函数测试react组件,unit-testing,jestjs,enzyme,Unit Testing,Jestjs,Enzyme,我试图用jest和Ezyme测试从异步函数返回的组件,但在构建它时遇到了问题 async function action() { return { chunks: ['something'], title: 'something', component: ( <Layout> <Something_else /> </Layout> ), }; } export default a

我试图用jest和Ezyme测试从异步函数返回的组件,但在构建它时遇到了问题

async function action() {
  return {
    chunks: ['something'],
    title: 'something',
    component: (
      <Layout>
        <Something_else />
      </Layout>
    ),
  };
}
export default action;
异步函数操作(){
返回{
块:['something'],
标题:“某物”,
组成部分:(
),
};
}
出口违约行为;
还有我的测试:

import React from 'react';
import {mount} from 'enzyme';
import index from './index.js';
import toJson from 'enzyme-to-json';

it('Snapshot test', () => {
        const i = index();
        i.then((r) => {

            const ccc = React.createClass({
                render() {
                   return r.component;
                   }
             })

             const wrapper = mount(<ccc />);

            expect(toJson(wrapper)).toMatchSnapshot();
        })
        .catch(() => {
            console.log('err');
        });
    });
从“React”导入React;
从“酶”导入{mount};
从“./index.js”导入索引;
从“酶到json”导入toJson;
它('快照测试',()=>{
常数i=索引();
i、 然后((r)=>{
const ccc=React.createClass({
render(){
返回r分量;
}
})
const wrapper=mount();
expect(toJson(wrapper)).toMatchSnapshot();
})
.catch(()=>{
console.log('err');
});
});
问题是,在我的快照中,我得到的只是一行文字,上面写着“
”,难道mount不应该扩展组件以至少显示它的子组件吗