0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/unit/webui/components/help.spec.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-11-29 08:14:56 -05:00
/**
* Help component
*/
import React from 'react';
import { shallow } from 'enzyme';
2017-12-01 14:04:01 -05:00
import SyntaxHighlighter from 'react-syntax-highlighter/dist/light';
import Help from '../../../../src/webui/src/components/Help/index';
2017-11-29 08:14:56 -05:00
2017-12-01 14:04:01 -05:00
describe('<Help /> component', () => {
2018-01-15 17:03:43 -05:00
2017-11-29 08:14:56 -05:00
it('should set html from props with / base path', () => {
2018-01-15 17:03:43 -05:00
jsdom.reconfigure({
url: "http://example.com/"
2017-11-29 08:14:56 -05:00
});
const wrapper = shallow(<Help />);
2017-12-01 14:04:01 -05:00
expect(
wrapper
.find('#adduser')
.find(SyntaxHighlighter)
.dive()
.text()
).toEqual('npm adduser --registry http://example.com');
expect(wrapper.html()).toMatchSnapshot();
2017-11-29 08:14:56 -05:00
});
it('should set html from props with someOtherPath', () => {
2018-01-15 17:03:43 -05:00
jsdom.reconfigure({
url: "http://example.com/someOtherPath"
2017-11-29 08:14:56 -05:00
});
const wrapper = shallow(<Help />);
2017-12-01 14:04:01 -05:00
expect(
wrapper
.find('#publish')
.find(SyntaxHighlighter)
.dive()
.text()
).toEqual('npm publish --registry http://example.com/someOtherPath');
expect(wrapper.html()).toMatchSnapshot();
2017-11-29 08:14:56 -05:00
});
});