instantjob-recruiter-client
Version:
a set of tools for creating an instantjob recruiter react client
41 lines (39 loc) • 1.39 kB
JSX
import React from 'react'
import {mount} from 'enzyme'
import {Provider} from 'react-redux'
import expect from 'expect'
import UsersList from 'components/users_list'
import FilterableList from 'components/filterable_list/filterable_list'
import Hover from 'components/utils/hover'
import state from 'tests/selectors/state'
import {get_users} from 'selectors/users'
import {get_users_fields} from 'selectors/fields'
import {array_from_hash, property_getter} from 'common/utilities'
import store from 'common/store'
describe('UsersList', () => {
it('should render', () => {
const fields = array_from_hash(get_users_fields(state))
expect(fields.length).toEqual(
array_from_hash(state.fields.fields)
.filter(({for_entity}) => for_entity == 'User')
.length
)
const users = array_from_hash(get_users(state))
expect(users.length).toEqual(array_from_hash(state.users.users).length)
expect(users[0].status.status).toEqual('mail')
expect(users[1].status.status).toEqual('applied')
const element = mount(
<Provider store={store}>
<UsersList
fields={fields}
users={users}
/>
</Provider>
)
expect(element.html()).toExist()
element.find(Hover).forEach((filter) => {
filter.simulate('mouseenter')
})
expect(element.find(FilterableList).prop('children').length).toEqual(2)
})
})