Passed
Push — master ( 9a73f0...7331d4 )
by Huu-Phat
01:50 queued 11s
created

cms/src/posts/state/__tests__/selector.spec.js   A

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 52
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 32
mnd 0
bc 0
fnc 7
dl 0
loc 52
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import {
2
  getOrder,
3
  getOrderColumn,
4
  getPage,
5
  getPosts,
6
  getRowsPerPage,
7
  getSelectedPosts
8
} from '../selectors'
9
10
describe('Posts selectors', () => {
11
  it('getOrder', function() {
12
    const posts = {
13
      order: 'asc'
14
    }
15
    expect(getOrder({ posts })).toEqual('asc')
16
  })
17
18
  it('getOrderColumn', function() {
19
    const posts = {
20
      orderColumn: 'title'
21
    }
22
    expect(getOrderColumn({ posts })).toEqual('title')
23
  })
24
25
  it('getPage', function() {
26
    const posts = {
27
      page: 0
28
    }
29
    expect(getPage({ posts })).toEqual(0)
30
  })
31
32
  it('getPosts', function() {
33
    const posts = {
34
      posts: []
35
    }
36
    expect(getPosts({ posts })).toEqual([])
37
  })
38
39
  it('getRowsPerPage', function() {
40
    const posts = {
41
      rowsPerPage: 15
42
    }
43
    expect(getRowsPerPage({ posts })).toEqual(15)
44
  })
45
46
  it('getSelectedPosts', function() {
47
    const posts = {
48
      selectedPosts: ['a', 'b']
49
    }
50
    expect(getSelectedPosts({ posts })).toEqual(['a', 'b'])
51
  })
52
})
53