add some unit tests
This commit is contained in:
		@@ -34,4 +34,16 @@ describe('<DynamicContentContainer/>', function () {
 | 
				
			|||||||
        wrapper.instance().clean();
 | 
					        wrapper.instance().clean();
 | 
				
			||||||
        expect(wrapper.find('a')).toHaveLength(0);
 | 
					        expect(wrapper.find('a')).toHaveLength(0);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it('test update', function () {
 | 
				
			||||||
 | 
					        const wrapper = shallow(<DynamicContentContainer data={[{}, {}, {}]} renderElement={(el) => (<a/>)}/>);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const func = jest.fn();
 | 
				
			||||||
 | 
					        wrapper.instance().clean = func;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // perform component update
 | 
				
			||||||
 | 
					        wrapper.setProps({data: [{}, {}]});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        expect(func).toHaveBeenCalledTimes(1);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								src/pages/TVShowPage/TVPlayer.test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/pages/TVShowPage/TVPlayer.test.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					import {shallow} from 'enzyme';
 | 
				
			||||||
 | 
					import {TVPlayer} from './TVPlayer';
 | 
				
			||||||
 | 
					import React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('<TVPlayer/>', () => {
 | 
				
			||||||
 | 
					    it('renders without crashing', function () {
 | 
				
			||||||
 | 
					        const wrapper = shallow(<TVPlayer match={{params: {id: 42}}}/>);
 | 
				
			||||||
 | 
					        wrapper.unmount();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@@ -24,7 +24,7 @@ interface EpisodeData {
 | 
				
			|||||||
    Path: string;
 | 
					    Path: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TVPlayer extends React.Component<Props, State> {
 | 
					export class TVPlayer extends React.Component<Props, State> {
 | 
				
			||||||
    state = {
 | 
					    state = {
 | 
				
			||||||
        loaded: false
 | 
					        loaded: false
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								src/pages/TVShowPage/TVShowPage.test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/pages/TVShowPage/TVShowPage.test.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					import {shallow} from 'enzyme';
 | 
				
			||||||
 | 
					import {TVShowPage} from './TVShowPage';
 | 
				
			||||||
 | 
					import React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('<TVShowPage/>', () => {
 | 
				
			||||||
 | 
					    it('renders without crashing', function () {
 | 
				
			||||||
 | 
					        const wrapper = shallow(<TVShowPage />);
 | 
				
			||||||
 | 
					        wrapper.unmount();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@@ -14,7 +14,7 @@ interface State {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
interface Props {}
 | 
					interface Props {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TVShowPage extends React.Component<Props, State> {
 | 
					export class TVShowPage extends React.Component<Props, State> {
 | 
				
			||||||
    state = {
 | 
					    state = {
 | 
				
			||||||
        loading: true
 | 
					        loading: true
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user