You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
783 B

  1. import { expect } from 'chai';
  2. import { render } from 'enzyme';
  3. import Avatar from '../../../app/assets/javascripts/components/components/avatar'
  4. describe('<Avatar />', () => {
  5. const src = '/path/to/image.jpg';
  6. const size = 100;
  7. const wrapper = render(<Avatar src={src} size={size} />);
  8. it('renders an img element with the given src', () => {
  9. expect(wrapper.find('img')).to.have.attr('src', `${src}`);
  10. });
  11. it('renders an img element of the given size', () => {
  12. ['width', 'height'].map((attr) => {
  13. expect(wrapper.find('img')).to.have.attr(attr, `${size}`);
  14. });
  15. });
  16. it('renders a div element of the given size', () => {
  17. ['width', 'height'].map((attr) => {
  18. expect(wrapper.find('div')).to.have.style(attr, `${size}px`);
  19. });
  20. });
  21. });