我正在为容器编写单元测试,并且希望覆盖率达到100%。但是,仍然有一项声明没有涵盖。
Index.js
const styles = theme => ({
BookContainer: {
backgroundColor: '#FAFAFA',
boxShadow:
'rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px',
},
...
我开玩笑的测试:
import BookTheme from 'components/BookTheme';
import BookTitle from 'components/BookTitle';
test('should render div tag for default case', () => {
const muiTheme = createMuiTheme(BookTheme);
const defaultFunc = () => {};
const defaultClasses = {};
const renderedComponent = shallow(
<BookContainer
classes={defaultClasses}
resetKeyword={defaultFunc}
theme={muiTheme}
/>,
);
expect(renderedComponent.find(BookTitle).length).toEqual(1);
});
在这个测试案例中,我如何获得100%的覆盖率?