我正在尝试从酶切法转换。 而使用react-testing-library运行快照会使我对现有快照之类的怪异更改
- className="flex"
+ class="flex"
or
- <Sidebar
+ <sidebar
这是我的基本测试。有人有什么想法吗?
jest.mock('./sidebar.js', () => 'Sidebar');
it('matches the saved snapshot', () => {
let { container } = renderComponent();
expect(container).toMatchSnapshot();
});
const renderComponent = ({ children = '{{children}}', ...rest } = {}) => render(
<Layout {...rest}>{children}</Layout>
);
谢谢!