闭社主体 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
838 B

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