导入组件测试报错 意思好像是说const声明组件没有初始值
来源:5-6 使用 TDD 的方式开发 Header 组件 (1)

weixin_慕仔0455571
2022-04-18
.test文件内代码:
import Enzyme, { shallow, mount } from ‘enzyme’;
import Adapter from ‘enzyme-adapter-react-16’;
import TeamAttendance from ‘…/…/pages/TeamAttendance/index’;
// TeamAttendanceForm组件内
Enzyme.configure({ adapter: new Adapter() });
describe(‘TeamAttendanceForm renders’, () => {
it(‘render TeamAttendanceForm’, () => {
const wrapper = shallow();
expect(wrapper.length).toBe(1);
});
// it(‘render TeamAttendanceForm-SearchForm’, () => {
// const wrapper = shallow();
// const SearchForm = wrapper.find(’[data-test=“SearchForm”]’);
// expect(SearchForm.length).toBe(1);
// });
});
报错:
Details:
SyntaxError: D:\app\ehr-team-attendance-pc\src\pages\TeamAttendance\index.tsx: Missing initializer in const declaration. (16:20)
14 |
15 | // 团队出勤
> 16 | const TeamAttendance: React.FC<{}> = (evan) => {
| ^
17 | // 查询条件
18 | const [params, setParams] = useState<Parameters>({
19 | // 如果不是只看直接下属,这个里面的值就是用户筛选的部门
写回答
1回答
-
Dell
2022-04-24
ts 没有解析,你这里写 js 的测试用例即可
00
相似问题