我正在使用TypeScript编写一个React应用程序。我为我的组件使用material-ui,为我的单元测试使用react-testing-library。我正在为material-ui的Grid组件编写一个包装器,这样我就可以始终拥有一个项目。我尝试使用助手库jest-dom的toHaveAttribute,如下所示:import React from "react";
import
我正在写单元测试,我想测试一个img属性。然而,当我进行断言时,我得到了位于__mocks__>fileMock.js下的模拟的img属性。因为我模拟文件,所以我只能得到模拟的文件属性。(selectedTools).toHaveAttribute('src', 'images/tools-selected.png');
测试结果为:
Buttons › Clear filterswork after filtering tools, workflows and using searchba