Jasmine 如何查找Jest、Ezyme、Create React应用程序、Shallow()的文档?
我正在使用Create React应用程序,并设置了如下测试文件:Jasmine 如何查找Jest、Ezyme、Create React应用程序、Shallow()的文档?,jasmine,jestjs,enzyme,create-react-app,Jasmine,Jestjs,Enzyme,Create React App,我正在使用Create React应用程序,并设置了如下测试文件: import React from 'react'; import { shallow, configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; let wrapper; beforeEach(() => { const defaultProps = { color: 'orange', val
import React from 'react';
import { shallow, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
let wrapper;
beforeEach(() => {
const defaultProps = {
color: 'orange',
value: 17,
title: 'live services',
link: 'htttp://google.com'
};
wrapper = shallow(<Callout {...defaultProps} />);
});
然后我使用shallow()设置包装器,如下所示:
import React from 'react';
import { shallow, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
let wrapper;
beforeEach(() => {
const defaultProps = {
color: 'orange',
value: 17,
title: 'live services',
link: 'htttp://google.com'
};
wrapper = shallow(<Callout {...defaultProps} />);
});
不起作用。这些find()方法在我当前的设置中不可用
在Jest文档中,我只能找到用于测试javaScript函数的断言,而找不到任何用于遍历和测试虚拟DOM或阴影DOM元素的方法,就像我一直在使用的那些(见上文)
如何在当前设置中查看shallow()和shallow.find()可用的断言?您可以在此处找到Jest断言方法
您还可以查看这个库包我在Jest文档中找不到我用来测试虚拟DOM的断言-您提到的库看起来很有趣-我可能会尝试一下,但如何找到当前可用断言的列表?