我使用create-react-app创建一个应用,然后弹出该应用。当前正在做我的测试套件,我想显示我的测试范围,所以在package.json下添加了“ collectCoverage”:true。运行测试后,它不会显示测试覆盖率的百分比
我需要做些什么吗?
这是Links.test.jsx
import React from "react";
import { shallow, mount } from "enzyme";
import Links from "./Links";
it("should show correct links", () => {
const wrapper = mount(<Links />);
expect(wrapper).toMatchSnapshot();
});
下面是正在测试的链接组件
import React from "react";
const Links = () => {
return (
<div className="container mb-4 mt-4" id="Links">
<div className="h4 mb-3">OUR LINKS</div>
<div className="d-flex justify-content-between flex-wrap mw-90">
<a
href="https://site.ca/sites.aspx"
target="_blank"
className="buttonImage siteImage"
>
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">My Site</div>
</div>
</a>
<a href="#" target="_blank" className="buttonImage mapsImage">
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">Maps</div>
</div>
</a>
<a href="#" target="_blank" className="buttonImage loopImage">
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">Social</div>
</div>
</a>
<a href="#" target="_blank" className="buttonImage polcyImage">
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">
Acceptable Use <br /> and Security Policies
</div>
</div>
</a>
</div>
</div>
);
};
export default Links;