我很难让我的测试涵盖此代码,我知道一旦完成,这将是一个简单的修复程序,但目前我无法考虑如何修复它。
这是我所拥有的功能。
const AssociateTabs = () => {
return (
<AppBar postion="absolute">
<Tabs>
<Typography variant="title" color="inherit">
{'Associate Work Dashboard'}
</Typography>
</Tabs>
</AppBar>
);
};
这些是我目前的测试
import React from 'react';
import ReactDOM from 'react-dom';
import Enzyme, { shallow, render, mount } from 'enzyme';
import AssociateTabs from '../../src/components/AssociateTabs';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
describe('AssociateTabs', () => {
const AssociateTabs = jest.fn();
const wrapper = shallow(<AssociateTabs/>);
it('should match snapshot data', () => {
expect(wrapper).toMatchSnapshot();
});
it('should match Associate Tabs', () => {
const wrapper = shallow(<AssociateTabs
Position={'absolute'} variant={'title'} color={'inherit'}
/>);
expect(wrapper).toMatchSnapshot();
});
it('should match return', () => {
const wrapper = shallow(<AssociateTabs />);
expect(wrapper).toBeDefined();
});
});