import {fromJS} from 'immutable';

import {getToUser} from './selector';

describe('widget-space selectors', () => {
  const otherUser = {
    entryEmail: 'ccwexpress@sparkbot.io',
    displayName: 'Nakia - Personal Assistant',
    entryUUID: '889869a1-f5b9-408b-a514-12704f02817a',
    emailAddress: 'ccwexpress@sparkbot.io',
    objectType: 'person',
    type: 'ROBOT',
    id: '889869a1-f5b9-408b-a514-12704f02817a',
    orgId: '1eb65fdf-9643-417f-9974-ad72cae0e10f'
  };
  it('gets the "to user"', () => {
    const currentUser = {
      entryEmail: 'qtcrabfq6f@2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b',
      displayName: 'User-qTCRABFq6f',
      entryUUID: '1c8ce4a0-df7b-4e62-8020-a1a430581e51',
      emailAddress: 'qtcrabfq6f@2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b',
      objectType: 'person',
      type: 'APPUSER',
      id: '1c8ce4a0-df7b-4e62-8020-a1a430581e51',
      orgId: '2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b'
    };

    const mockedConversation = fromJS({
      participants: [currentUser, otherUser]
    });

    const toUser = getToUser.resultFunc(mockedConversation, currentUser);
    expect(toUser.get('displayName')).toBe(otherUser.displayName);
  });
  it('gets the "to user" with capitalized email', () => {
    const currentUser = {
      entryEmail: 'qTCRABFq6f@2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b',
      displayName: 'User-qTCRABFq6f',
      entryUUID: '1c8ce4a0-df7b-4e62-8020-a1a430581e51',
      emailAddress: 'qTCRABFq6f@2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b',
      objectType: 'person',
      type: 'APPUSER',
      id: '1c8ce4a0-df7b-4e62-8020-a1a430581e51',
      orgId: '2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b'
    };

    const mockedConversation = fromJS({
      participants: [currentUser, otherUser]
    });

    const toUser = getToUser.resultFunc(mockedConversation, currentUser);
    expect(toUser.get('displayName')).toBe(otherUser.displayName);
  });
});

@@ -149,26 +149,23 @@
 Email: '
-ccwexpress
+fakebot
 @sparkbo
@@ -193,16 +193,8 @@
 e: '
-Nakia - 
 Pers
@@ -207,16 +207,20 @@
 ssistant
+ Bot
 ',%0A    e
@@ -234,44 +234,44 @@
 D: '
-889869a1-f5b9-408b-a514-12704f02817a
+c04b6751-bbed-4ac8-aa63-9654b757e171
 ',%0A 
@@ -292,18 +292,15 @@
 s: '
-ccwexpress
+fakebot
 @spa
@@ -368,44 +368,44 @@
 d: '
-889869a1-f5b9-408b-a514-12704f02817a
+c04b6751-bbed-4ac8-aa63-9654b757e171
 ',%0A 
@@ -419,44 +419,44 @@
 d: '
-1eb65fdf-9643-417f-9974-ad72cae0e10f
+ac9c7b0d-77e3-4ab9-b8f6-b092c57e5999
 '%0A  
@@ -553,44 +553,44 @@
 q6f@
-2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b
+4c45deca-dc35-4c44-9941-b0c7ba8f7b13
 ',%0A 
@@ -719,44 +719,44 @@
 q6f@
-2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b
+4c45deca-dc35-4c44-9941-b0c7ba8f7b13
 ',%0A 
@@ -873,44 +873,44 @@
 d: '
-2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b
+4c45deca-dc35-4c44-9941-b0c7ba8f7b13
 '%0A  
@@ -1274,44 +1274,44 @@
 q6f@
-2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b
+4c45deca-dc35-4c44-9941-b0c7ba8f7b13
 ',%0A 
@@ -1440,44 +1440,44 @@
 q6f@
-2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b
+4c45deca-dc35-4c44-9941-b0c7ba8f7b13
 ',%0A 
@@ -1594,44 +1594,44 @@
 d: '
-2cecfb0e-f9fc-45cb-b8fc-1f9ebf87209b
+4c45deca-dc35-4c44-9941-b0c7ba8f7b13
 '%0A  

rename IDs