1
|
|
|
import * as imports from './../src/'; |
2
|
|
|
import { is } from 'immutable'; |
3
|
|
|
import expect from 'expect'; |
4
|
|
|
import { diff } from 'deep-diff'; |
5
|
|
|
|
6
|
|
|
expect.extend({ |
7
|
|
|
toEqualImmutable(expected) { |
8
|
|
|
expect.assert( |
9
|
|
|
is(this.actual, expected), |
10
|
|
|
'Expected \n%s\nto be equivalent to actual \n%s\n Diff: %s', |
11
|
|
|
expected, |
12
|
|
|
this.actual, |
13
|
|
|
diff( |
14
|
|
|
expected && expected.toJS |
15
|
|
|
? expected.toJS() |
16
|
|
|
: expected, |
17
|
|
|
this.actual && this.actual.toJS |
18
|
|
|
? this.actual.toJS() |
19
|
|
|
: this.actual |
20
|
|
|
) |
21
|
|
|
); |
22
|
|
|
} |
23
|
|
|
}); |
24
|
|
|
|
25
|
|
|
function reducerTest(reducerKey) { |
26
|
|
|
expect(imports.Reducers[reducerKey]).toBeTruthy(); |
27
|
|
|
expect(typeof imports.Reducers[reducerKey]).toEqual('function'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
describe('React Redux Grid Exports', () => { |
31
|
|
|
|
32
|
|
|
it('Should export modules', () => { |
33
|
|
|
expect(imports).toBeTruthy(); |
34
|
|
|
}); |
35
|
|
|
|
36
|
|
|
it('Should export 6 modules', () =>{ |
37
|
|
|
expect(Object.keys(imports).length).toEqual(6); |
38
|
|
|
}); |
39
|
|
|
|
40
|
|
|
}); |
41
|
|
|
|
42
|
|
|
describe('Grid Export', () =>{ |
43
|
|
|
|
44
|
|
|
it('Should export a Grid', () =>{ |
45
|
|
|
expect(imports.Grid).toBeTruthy(); |
46
|
|
|
expect(typeof imports.Grid).toEqual('function'); |
47
|
|
|
}); |
48
|
|
|
|
49
|
|
|
}); |
50
|
|
|
|
51
|
|
|
describe('Store Export', () =>{ |
52
|
|
|
|
53
|
|
|
it('Should export a Grid', () =>{ |
54
|
|
|
expect(imports.Store).toBeTruthy(); |
55
|
|
|
expect(typeof imports.Store).toEqual('object'); |
56
|
|
|
expect(imports.Store.dispatch).toBeTruthy(); |
57
|
|
|
expect(typeof imports.Store.dispatch).toEqual('function'); |
58
|
|
|
}); |
59
|
|
|
|
60
|
|
|
}); |
61
|
|
|
|
62
|
|
|
describe('Reducers Export', () =>{ |
63
|
|
|
|
64
|
|
|
it('Should export all Reducers', () =>{ |
65
|
|
|
expect(imports.Reducers).toBeTruthy(); |
66
|
|
|
expect(typeof imports.Reducers).toEqual('object'); |
67
|
|
|
expect(Object.keys(imports.Reducers).length).toEqual(9); |
68
|
|
|
}); |
69
|
|
|
|
70
|
|
|
it('Should export a DataSource Reducer', () =>{ |
71
|
|
|
reducerTest('DataSource'); |
72
|
|
|
}); |
73
|
|
|
|
74
|
|
|
it('Should export a Grid Reducer', () =>{ |
75
|
|
|
reducerTest('Grid'); |
76
|
|
|
}); |
77
|
|
|
|
78
|
|
|
it('Should export a BulkActions Reducer', () =>{ |
79
|
|
|
reducerTest('BulkActions'); |
80
|
|
|
}); |
81
|
|
|
|
82
|
|
|
it('Should export a Editor Reducer', () =>{ |
83
|
|
|
reducerTest('Editor'); |
84
|
|
|
}); |
85
|
|
|
|
86
|
|
|
it('Should export a ErrorHandler Reducer', () =>{ |
87
|
|
|
reducerTest('ErrorHandler'); |
88
|
|
|
}); |
89
|
|
|
|
90
|
|
|
it('Should export a Loader Reducer', () =>{ |
91
|
|
|
reducerTest('Loader'); |
92
|
|
|
}); |
93
|
|
|
|
94
|
|
|
it('Should export a Menu Reducer', () =>{ |
95
|
|
|
reducerTest('Menu'); |
96
|
|
|
}); |
97
|
|
|
|
98
|
|
|
it('Should export a Pager Reducer', () =>{ |
99
|
|
|
reducerTest('Pager'); |
100
|
|
|
}); |
101
|
|
|
|
102
|
|
|
it('Should export a Selection Reducer', () =>{ |
103
|
|
|
reducerTest('Selection'); |
104
|
|
|
}); |
105
|
|
|
|
106
|
|
|
}); |
107
|
|
|
|
108
|
|
|
describe('Combined Root Reducer Export', () =>{ |
109
|
|
|
|
110
|
|
|
it('Should export a root Reducer', () =>{ |
111
|
|
|
expect(imports.GridRootReducer).toBeTruthy(); |
112
|
|
|
expect(typeof imports.GridRootReducer).toEqual('function'); |
113
|
|
|
}); |
114
|
|
|
|
115
|
|
|
}); |
116
|
|
|
|