forked from giranm/pd-live-react
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from PagerDuty/issue-80
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/components/IncidentTable/subcomponents/PersonInitialsComponents.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { | ||
Provider, | ||
} from 'react-redux'; | ||
|
||
import { | ||
mockStore, | ||
} from 'mocks/store.test'; | ||
|
||
import { | ||
generateMockUsers, | ||
} from 'mocks/users.test'; | ||
|
||
import { | ||
mount, | ||
} from 'enzyme'; | ||
|
||
import PersonInitialsComponents from './PersonInitialsComponents'; | ||
|
||
describe('PersonInitialsComponents', () => { | ||
const users = generateMockUsers(2); | ||
users[0].summary = 'Abraham Lincoln'; | ||
users[1].summary = 'George Washington 📟'; | ||
let baseStore; | ||
let store; | ||
beforeEach(() => { | ||
const usersMap = {}; | ||
users.forEach((user) => { | ||
usersMap[user.id] = user; | ||
}); | ||
baseStore = { | ||
users: { | ||
usersMap, | ||
}, | ||
}; | ||
store = mockStore(baseStore); | ||
global.CSS = jest.fn(); | ||
}); | ||
|
||
it('should render component with assignee initials', () => { | ||
const displayedUsers = users.map((user) => ({ | ||
user, | ||
})); | ||
const wrapper = mount( | ||
<Provider store={store}> | ||
<PersonInitialsComponents displayedUsers={displayedUsers} /> | ||
</Provider>, | ||
); | ||
// Initials should be rendered | ||
expect(wrapper.find('div[role="img"]').contains('AL')).toBeTruthy(); | ||
// Emojis should also be rendered as initials | ||
expect(wrapper.find('div[role="img"]').contains('G📟')).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters