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 7 modules', () =>{
|
37 | expect(Object.keys(imports).length).toEqual(7);
|
38 | });
|
39 |
|
40 | });
|
41 |
|
42 | describe('Action Types Export', () =>{
|
43 |
|
44 | it('Should export the Action Types', () =>{
|
45 | expect(imports.ActionTypes).toBeTruthy();
|
46 | expect(imports.ActionTypes.SELECT_ROW)
|
47 | .toEqual('@@react-redux-grid/SELECT_ROW');
|
48 | });
|
49 |
|
50 | });
|
51 |
|
52 | describe('Grid Export', () =>{
|
53 |
|
54 | it('Should export a Grid', () =>{
|
55 | expect(imports.Grid).toBeTruthy();
|
56 | expect(typeof imports.Grid).toEqual('function');
|
57 | });
|
58 |
|
59 | });
|
60 |
|
61 | describe('Store Export', () =>{
|
62 |
|
63 | it('Should export a Grid', () =>{
|
64 | expect(imports.Store).toBeTruthy();
|
65 | expect(typeof imports.Store).toEqual('object');
|
66 | expect(imports.Store.dispatch).toBeTruthy();
|
67 | expect(typeof imports.Store.dispatch).toEqual('function');
|
68 | });
|
69 |
|
70 | });
|
71 |
|
72 | describe('Reducers Export', () =>{
|
73 |
|
74 | it('Should export all Reducers', () =>{
|
75 | expect(imports.Reducers).toBeTruthy();
|
76 | expect(typeof imports.Reducers).toEqual('object');
|
77 | expect(Object.keys(imports.Reducers).length).toEqual(9);
|
78 | });
|
79 |
|
80 | it('Should export a DataSource Reducer', () =>{
|
81 | reducerTest('dataSource');
|
82 | });
|
83 |
|
84 | it('Should export a Grid Reducer', () =>{
|
85 | reducerTest('grid');
|
86 | });
|
87 |
|
88 | it('Should export a BulkActions Reducer', () =>{
|
89 | reducerTest('bulkAction');
|
90 | });
|
91 |
|
92 | it('Should export a Editor Reducer', () =>{
|
93 | reducerTest('editor');
|
94 | });
|
95 |
|
96 | it('Should export a ErrorHandler Reducer', () =>{
|
97 | reducerTest('errorHandler');
|
98 | });
|
99 |
|
100 | it('Should export a Loader Reducer', () =>{
|
101 | reducerTest('loader');
|
102 | });
|
103 |
|
104 | it('Should export a Menu Reducer', () =>{
|
105 | reducerTest('menu');
|
106 | });
|
107 |
|
108 | it('Should export a Pager Reducer', () =>{
|
109 | reducerTest('pager');
|
110 | });
|
111 |
|
112 | it('Should export a Selection Reducer', () =>{
|
113 | reducerTest('selection');
|
114 | });
|
115 |
|
116 | });
|