mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-04-01 02:42:23 -05:00
webui: <Help /> component test case
This commit is contained in:
parent
e38f284b0b
commit
6a6d7ed4de
1 changed files with 38 additions and 0 deletions
38
test/webui/components/help.spec.js
Normal file
38
test/webui/components/help.spec.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* Help component
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import Help from '../../../src/webui/src/components/Help';
|
||||
|
||||
describe('<NoItem /> component', () => {
|
||||
beforeEach(() => {
|
||||
/**
|
||||
* @see https://github.com/facebook/jest/issues/890
|
||||
*/
|
||||
Object.defineProperty(window.location, 'origin', {
|
||||
writable: true,
|
||||
value: 'http://example.com'
|
||||
});
|
||||
});
|
||||
it('should set html from props with / base path', () => {
|
||||
Object.defineProperty(window.location, 'pathname', {
|
||||
writable: true,
|
||||
value: '/'
|
||||
});
|
||||
const wrapper = shallow(<Help />);
|
||||
expect(wrapper.html()).toEqual(
|
||||
'<div><li><h1>No Package Published Yet</h1><p><div>To publish your first package just:</div><br/><strong>1. Login</strong><pre style="display:block;overflow-x:auto;padding:0.5em;background:#000;color:#f8f8f8"><code>npm adduser --registry http:<span style="color:#aeaeae;font-style:italic">//example.com</span></code></pre><strong>2. Publish</strong><pre style="display:block;overflow-x:auto;padding:0.5em;background:#000;color:#f8f8f8"><code>npm publish --registry http:<span style="color:#aeaeae;font-style:italic">//example.com</span></code></pre><strong>3. Refresh this page!</strong></p></li></div>'
|
||||
);
|
||||
});
|
||||
|
||||
it('should set html from props with someOtherPath', () => {
|
||||
Object.defineProperty(window.location, 'pathname', {
|
||||
writable: true,
|
||||
value: '/someOtherPath'
|
||||
});
|
||||
const wrapper = shallow(<Help />);
|
||||
expect(wrapper.html()).toEqual('<div><li><h1>No Package Published Yet</h1><p><div>To publish your first package just:</div><br/><strong>1. Login</strong><pre style="display:block;overflow-x:auto;padding:0.5em;background:#000;color:#f8f8f8"><code>npm adduser --registry http:<span style="color:#aeaeae;font-style:italic">//example.com/someOtherPath</span></code></pre><strong>2. Publish</strong><pre style="display:block;overflow-x:auto;padding:0.5em;background:#000;color:#f8f8f8"><code>npm publish --registry http:<span style="color:#aeaeae;font-style:italic">//example.com/someOtherPath</span></code></pre><strong>3. Refresh this page!</strong></p></li></div>');
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue