闭社主体 forked from https://github.com/tootsuite/mastodon
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.

27 lines
857 B

  1. import { expect } from 'chai';
  2. import { render } from 'enzyme';
  3. import Immutable from 'immutable';
  4. import React from 'react';
  5. import DisplayName from '../../../app/javascript/mastodon/components/display_name';
  6. describe('<DisplayName />', () => {
  7. it('renders display name + account name', () => {
  8. const account = Immutable.fromJS({
  9. username: 'bar',
  10. acct: 'bar@baz',
  11. display_name: 'Foo',
  12. });
  13. const wrapper = render(<DisplayName account={account} />);
  14. expect(wrapper).to.have.text('Foo @bar@baz');
  15. });
  16. it('renders the username + account name if display name is empty', () => {
  17. const account = Immutable.fromJS({
  18. username: 'bar',
  19. acct: 'bar@baz',
  20. display_name: '',
  21. });
  22. const wrapper = render(<DisplayName account={account} />);
  23. expect(wrapper).to.have.text('bar @bar@baz');
  24. });
  25. });