UNPKG

1.97 kBJavaScriptView Raw
1import reduxGrid from 'react-ai'
2import React from 'react'
3import Immutable from 'immutable'
4import * as ReactVirtualized from 'react-virtualized'
5import { createStore } from 'redux'
6import { Provider, connect } from 'react-redux'
7import { mount, shallow } from 'enzyme'
8import { spy } from 'sinon'
9const chai = require('chai')
10chai.use(require('chai-enzyme')())
11const should = chai.should()
12
13describe('reduxGrid', () => {
14 it('exists', () => should.exist(reduxGrid))
15 it('should be a function', () => reduxGrid.should.be.a('function'))
16 it('throws for no parameters', () => (() => reduxGrid()).should.throw())
17 it('should throw for invalid dependencies (React, ReactVirtualized, connect)', () => (() => reduxGrid({ React, ReactVirtualized, connect })).should.throw())
18
19 const getState = () => {}
20 const ContentBox = props => <div>{props.children}</div>
21 it('should not throw for valid dependencies (React, ReactVirtualized, connect, getState, Immutable, ContentBox)', () => (() => reduxGrid({ React, ReactVirtualized, connect, getState, Immutable, ContentBox })).should.not.throw())
22
23 describe('<CoreGrid />', () => {
24 const reducer = (state = {}, action = {}) => {}
25 const store = createStore(reducer)
26 const { CoreGrid } = reduxGrid({ React, ReactVirtualized, connect, getState, Immutable, ContentBox })
27 it('should exist', () => should.exist(CoreGrid))
28 it('should shallow mount', () => (() => shallow(<Provider store={store}><CoreGrid /></Provider>)).should.not.throw())
29 })
30
31 describe('<DrillGrid />', () => {
32 const reducer = (state = {}, action = {}) => {}
33 const store = createStore(reducer)
34 const { DrillGrid } = reduxGrid({ React, ReactVirtualized, connect, getState, Immutable, ContentBox })
35 it('should exist', () => should.exist(DrillGrid))
36 it('should shallow mount', () => (() => shallow(<Provider store={store}><DrillGrid /></Provider>)).should.not.throw())
37 })
38})
39
40