Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 24 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* eslint-env jest */ |
||
2 | import { lensPath } from 'ramda' |
||
3 | import { stateToProps } from './stateToProps' |
||
4 | |||
5 | it('Converts map function to props', () => { |
||
6 | const state = { auth: { token: 'token' } } |
||
7 | |||
8 | const mapToProps = state => ({ |
||
9 | token: state.auth.token |
||
10 | }) |
||
11 | |||
12 | const props = stateToProps(mapToProps)({ state }) |
||
13 | |||
14 | expect(props).toEqual({ token: 'token' }) |
||
15 | }) |
||
16 | |||
17 | it('Converts lens object to props', () => { |
||
18 | const state = { auth: { token: 'token' } } |
||
19 | const tokenLens = lensPath(['auth', 'token']) |
||
20 | const mapToProps = { token: tokenLens } |
||
21 | |||
22 | const props = stateToProps(mapToProps)({ state }) |
||
23 | |||
24 | expect(props).toEqual({ token: 'token' }) |
||
25 | }) |
||
26 |