Skip to content

Commit

Permalink
Merge pull request #253 from we3x/feature/testing
Browse files Browse the repository at this point in the history
Clear test
  • Loading branch information
we3x authored Jun 24, 2016
2 parents 8ccbffc + c4ca8a5 commit 02a9971
Show file tree
Hide file tree
Showing 50 changed files with 515 additions and 408 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "server.js",
"scripts": {
"start": "webpack-dev-server --inline --hot --host 0.0.0.0 --color",
"pretest": "eslint src/",
"test": "NODE_ENV=production node_modules/.bin/babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha -- -R xunit-file src/test.js",
"coverage": "NODE_ENV=production istanbul report cobertura --dir shippable/codecoverage/",
"build": "webpack -p --config webpack.config.prod.js src/index.js",
Expand Down
27 changes: 15 additions & 12 deletions src/components/auth/tests/auth.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
/* eslint no-undef: 0 */
/* eslint no-unused-expressions: 0 */
/* eslint no-sequences: 0 */
import expect from 'expect';
import actions from '../actions';
import store from '../../../store';
import { LOGIN } from '../constants';

const loginTest = describe('Testing login', () => {
it('get pending state', () => {
expect(store.dispatch(actions.begin()))
it('get pending state', () => {
expect(store.dispatch(actions.begin()))
.toEqual({
payload: {
status: 'pending',
},
type: LOGIN,
});
}),
it('get error state', () => {
expect(store.dispatch(actions.fail({ message: 'ErorR'})))
.toEqual({
payload: {
status: 'error',
error: 'ErorR',
},
type: LOGIN,
});
});
it('get error state', () => {
expect(store.dispatch(actions.fail({ message: 'ErorR' })))
.toEqual({
payload: {
status: 'error',
error: 'ErorR',
},
type: LOGIN,
});
});
});

export default loginTest;
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ const ProviderCreate = React.createClass({
{
this.props.plugins.map(
plugin =>
<option
key={plugin.type}
value={plugin.type}
> {plugin.type}</option>
<option
key={plugin.type}
value={plugin.type}
> {plugin.type}</option>
)
}
</select>
Expand Down
41 changes: 22 additions & 19 deletions src/components/cluster/components/provider/components/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,28 @@ const ProviderDetail = React.createClass({
}
return (
<div>
<h2>Provider {this.props.provider.name}</h2>
<ul className="item__list">
<li className="item__heading">
Name:
<InlineEdit
text={this.props.provider.name}
change={this.dataChanged}
paramName="name"
/>
</li>
<li className="item__child">
<Link to={
`/clusters/${clusterId}/providers/${this.props.provider.name}/hosts/`
}
>
Hosts
</Link>
</li>
</ul>
<h2>
Provider {this.props.provider.name}
</h2>
<ul className="item__list">
<li className="item__heading">
Name:
<InlineEdit
text={this.props.provider.name}
change={this.dataChanged}
paramName="name"
/>
</li>
<li className="item__child">
<Link
to={
`/clusters/${clusterId}/providers/${this.props.provider.name}/hosts/`
}
>
Hosts
</Link>
</li>
</ul>
<Link to={`/clusters/${clusterId}/providers/${this.props.provider.name}/remove/`}>
Remove
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import actions from '../actions/create';
import store from '../../../../../../../store';
import { history } from '../../../../../../../constants';
import Spinner from '../../../.../../../../../layout/spinner';
import Spinner from '../../../../../../layout/spinner';


const errorMessages = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ const HostList = React.createClass({
detailLink += `/hosts/${host.hostname}/`;
return (
<li key={host.hostname}>
<Link
key={host.hostname}
to={detailLink}
host={host}
> {host.hostname} </Link> </li>
<Link
key={host.hostname}
to={detailLink}
host={host}
> {host.hostname} </Link>
</li>
);
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
/* eslint no-undef: 0 */
/* eslint no-unused-expressions: 0 */
/* eslint no-sequences: 0 */
import expect from 'expect';
import actions from '../actions/create';
import store from '../../../../../../../store';
import { HOST_CREATE } from '../constants';


const hostCreateTest = describe('Testing create of host', () => {
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
.toEqual({
payload: {
status: 'initial',
},
type: HOST_CREATE,
})
});
}),
it('get success state', () => {
expect(store.dispatch(actions.success({})))
Expand All @@ -22,17 +25,17 @@ const hostCreateTest = describe('Testing create of host', () => {
status: 'success',
},
type: HOST_CREATE,
})
}),
});
}),
it('get pending state', () => {
expect(store.dispatch(actions.begin()))
.toEqual({
payload: {
status: 'pending',
},
type: HOST_CREATE,
})
}),
});
}),
it('get error state', () => {
expect(store.dispatch(actions.fail('ErorR')))
.toEqual({
Expand All @@ -41,8 +44,8 @@ const hostCreateTest = describe('Testing create of host', () => {
error: 'ErorR',
},
type: HOST_CREATE,
})
})
});
});
});

export default hostCreateTest;
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
/* eslint no-undef: 0 */
/* eslint no-unused-expressions: 0 */
/* eslint no-sequences: 0 */
import expect from 'expect';
import actions from '../actions/detail';
import store from '../../../../../../../store';
import { HOST_DETAIL } from '../constants';


const hostDetailTest = describe('Testing detail of host', () => {
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
.toEqual({
payload: {
status: 'initial',
},
type: HOST_DETAIL,
})
});
}),
it('get success state', () => {
expect(store.dispatch(actions.success({})))
Expand All @@ -22,17 +25,17 @@ const hostDetailTest = describe('Testing detail of host', () => {
status: 'success',
},
type: HOST_DETAIL,
})
}),
});
}),
it('get pending state', () => {
expect(store.dispatch(actions.begin()))
.toEqual({
payload: {
status: 'pending',
},
type: HOST_DETAIL,
})
}),
});
}),
it('get error state', () => {
expect(store.dispatch(actions.fail('ErorR')))
.toEqual({
Expand All @@ -41,8 +44,8 @@ const hostDetailTest = describe('Testing detail of host', () => {
error: 'ErorR',
},
type: HOST_DETAIL,
})
})
});
});
});

export default hostDetailTest;
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
/* eslint no-undef: 0 */
/* eslint no-unused-expressions: 0 */
/* eslint no-sequences: 0 */
import expect from 'expect';
import actions from '../actions/edit';
import store from '../../../../../../../store';
import { HOST_EDIT } from '../constants';


const hostEditTest = describe('Testing edit of host', () => {
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
.toEqual({
payload: {
status: 'initial',
},
type: HOST_EDIT,
})
});
}),
it('get success state', () => {
expect(store.dispatch(actions.success({})))
Expand All @@ -22,17 +25,17 @@ const hostEditTest = describe('Testing edit of host', () => {
status: 'success',
},
type: HOST_EDIT,
})
}),
});
}),
it('get pending state', () => {
expect(store.dispatch(actions.begin()))
.toEqual({
payload: {
status: 'pending',
},
type: HOST_EDIT,
})
}),
});
}),
it('get error state', () => {
expect(store.dispatch(actions.fail('ErorR')))
.toEqual({
Expand All @@ -41,8 +44,8 @@ const hostEditTest = describe('Testing edit of host', () => {
error: 'ErorR',
},
type: HOST_EDIT,
})
})
});
});
});

export default hostEditTest;
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
/* eslint no-undef: 0 */
/* eslint no-unused-expressions: 0 */
/* eslint no-sequences: 0 */
import expect from 'expect';
import actions from '../actions/list';
import store from '../../../../../../../store';
import { HOST_LIST } from '../constants';


const hostListTest = describe('Testing host list', () => {
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
it('get initial state', () => {
expect(store.dispatch(actions.reset()))
.toEqual({
payload: {
status: 'initial',
hosts: [],
},
type: HOST_LIST,
})
});
}),
it('get success state', () => {
expect(store.dispatch(actions.success({})))
Expand All @@ -23,8 +26,8 @@ const hostListTest = describe('Testing host list', () => {
status: 'success',
},
type: HOST_LIST,
})
}),
});
}),
it('get pending state', () => {
expect(store.dispatch(actions.begin()))
.toEqual({
Expand All @@ -33,19 +36,19 @@ const hostListTest = describe('Testing host list', () => {
hosts: [],
},
type: HOST_LIST,
})
}),
});
}),

it('get error state', () => {
expect(store.dispatch(actions.fail('erroR')))
.toEqual({
payload: {
status: 'error',
error: 'erroR'
error: 'erroR',
},
type: HOST_LIST,
})
})
});
});
});

export default hostListTest;
Loading

0 comments on commit 02a9971

Please sign in to comment.