mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
Package detail component test
This commit is contained in:
parent
c56c03065b
commit
753281effe
1 changed files with 27 additions and 0 deletions
27
test/webui/components/packagedetail.spec.js
Normal file
27
test/webui/components/packagedetail.spec.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* PackageDetail component
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import PackageDetail from '../../../src/webui/src/components/PackageDetail';
|
||||
|
||||
console.error = jest.fn();
|
||||
|
||||
describe('<PackageDetail /> component', () => {
|
||||
it('should give error for required props', () => {
|
||||
shallow(<PackageDetail />);
|
||||
expect(console.error).toBeCalled();
|
||||
});
|
||||
|
||||
it('should load the component', () => {
|
||||
const props = {
|
||||
readMe: 'Test readme',
|
||||
package: 'Verdaccio'
|
||||
};
|
||||
const wrapper = shallow(<PackageDetail {...props} />);
|
||||
|
||||
expect(wrapper.find('h1').text()).toEqual('Verdaccio');
|
||||
|
||||
// here write a test to match readMe prop
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue