src/stateToProps.test.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 24
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
mnd 0
bc 0
fnc 3
dl 0
loc 24
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
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