This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2016-10-17 17:54:49 -07:00
|
|
|
import { expect } from 'chai';
|
|
|
|
import { render } from 'enzyme';
|
|
|
|
import Immutable from 'immutable';
|
|
|
|
|
2017-05-02 17:04:16 -07:00
|
|
|
import DisplayName from '../../../app/javascript/mastodon/components/display_name'
|
2016-10-17 17:54:49 -07:00
|
|
|
|
|
|
|
describe('<DisplayName />', () => {
|
2016-10-20 08:34:44 -07:00
|
|
|
it('renders display name + account name', () => {
|
|
|
|
const account = Immutable.fromJS({
|
|
|
|
username: 'bar',
|
|
|
|
acct: 'bar@baz',
|
|
|
|
display_name: 'Foo'
|
|
|
|
});
|
|
|
|
const wrapper = render(<DisplayName account={account} />);
|
|
|
|
expect(wrapper).to.have.text('Foo @bar@baz');
|
2016-10-17 17:54:49 -07:00
|
|
|
});
|
|
|
|
|
2016-10-20 08:34:44 -07:00
|
|
|
it('renders the username + account name if display name is empty', () => {
|
|
|
|
const account = Immutable.fromJS({
|
|
|
|
username: 'bar',
|
|
|
|
acct: 'bar@baz',
|
|
|
|
display_name: ''
|
|
|
|
});
|
|
|
|
const wrapper = render(<DisplayName account={account} />);
|
|
|
|
expect(wrapper).to.have.text('bar @bar@baz');
|
2016-10-17 17:54:49 -07:00
|
|
|
});
|
|
|
|
});
|