0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00
verdaccio/test/unit/webui/components
..
__mocks__
__snapshots__
PackageSidebar refactor: get rid of personal emails 2018-06-23 20:59:34 +02:00
store
header.spec.js
help.spec.js
noitems.spec.js
notfound.spec.js
package.spec.js
packagedetail.spec.js
packagelist.spec.js
readme.spec.js
search.spec.js

/**
 * Readme component
 */

import React from 'react';
import { shallow } from 'enzyme';
import Readme from '../../../../src/webui/src/components/Readme/index';

console.error = jest.fn();

describe('<Readme /> component', () => {
  it('should give error for the required fields', () => {
    shallow(<Readme />);
    expect(console.error).toBeCalled();
  });

  it('should dangerously set html', () => {
    const props = {
      readMe: '<h1>This is a test string</h1>'
    };
    const wrapper = shallow(<Readme {...props} />);
    expect(wrapper.html()).toEqual(
      '<div class="markdown-body"><h1>This is a test string</h1></div>'
    );
    expect(wrapper.html()).toMatchSnapshot();
  });
});