about summary refs log tree commit diff
path: root/spec/javascript/components/display_name.test.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascript/components/display_name.test.jsx')
-rw-r--r--spec/javascript/components/display_name.test.jsx24
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/javascript/components/display_name.test.jsx b/spec/javascript/components/display_name.test.jsx
index c25eb8530..e5a932f4b 100644
--- a/spec/javascript/components/display_name.test.jsx
+++ b/spec/javascript/components/display_name.test.jsx
@@ -5,15 +5,23 @@ import Immutable  from 'immutable';
 import DisplayName from '../../../app/assets/javascripts/components/components/display_name'
 
 describe('<DisplayName />', () => {
-  const account = Immutable.fromJS({
-    username: 'bar',
-    acct: 'bar@baz',
-    display_name: 'Foo'
+  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');
   });
 
-  const wrapper = render(<DisplayName account={account} />);
-
-  it('renders display name', () => {
-    expect(wrapper.text()).to.match(/Foo @bar@baz/);
+  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');
   });
 });