This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import { Provider } from 'react-redux'; | ||
import store from '../../store'; | ||
import TabsContainer from './index'; | ||
import Tabs from './tabs'; | ||
describe('TabsContainer', () => { | ||
it('should render Tabs component', () => { | ||
const wrapper = mount(<Provider store={store}><TabsContainer /></Provider>); | ||
expect(wrapper.find(Tabs).exists()).to.equal(true); | ||
}); | ||
}); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import chai, { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import { Tab, Tabs as ToolboxTabs } from 'react-toolbox'; | ||
import sinon from 'sinon'; | ||
import sinonChai from 'sinon-chai'; | ||
import Tabs from './tabs'; | ||
|
||
chai.use(sinonChai); | ||
|
||
describe('Tabs', () => { | ||
const history = { | ||
location: { | ||
pathname: '/main/voting', | ||
}, | ||
push: sinon.spy(), | ||
}; | ||
|
||
it('should render react toolbox Tabs component', () => { | ||
const wrapper = mount(<Tabs history={history} />); | ||
expect(wrapper.find(ToolboxTabs).exists()).to.equal(true); | ||
}); | ||
|
||
it('should render 3 Tab components if props.isDelegate', () => { | ||
const wrapper = mount(<Tabs isDelegate={true} history={history} />); | ||
expect(wrapper.find(Tab)).to.have.lengthOf(3); | ||
}); | ||
|
||
it('should render 2 Tab components if !props.isDelegate', () => { | ||
const wrapper = mount(<Tabs isDelegate={false} history={history} />); | ||
expect(wrapper.find(Tab)).to.have.lengthOf(2); | ||
}); | ||
|
||
it('should allow to change active tab', () => { | ||
const wrapper = mount(<Tabs isDelegate={false} history={history} />); | ||
wrapper.find(Tab).at(0).simulate('click'); | ||
expect(history.push).to.have.been.calledWith('transactions'); | ||
}); | ||
}); |