Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Added some more cases to test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatansalas committed Apr 1, 2017
1 parent f640c2c commit 17b3ea3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
node_modules
.idea
dist
dist
coverage
3 changes: 2 additions & 1 deletion .npmignore
Expand Up @@ -6,4 +6,5 @@ docs
node_modules
src
test
LICENSE
LICENSE
coverage
12 changes: 11 additions & 1 deletion test/withFetch.spec.js
Expand Up @@ -95,6 +95,16 @@ describe('Testing -> <FetchComponent/>', () => {
expect(WrappedComponent.prototype.componentWillUnmount).to.be.a('function');
});

it('set data and loading in false in <FetchComponent/>', () => {
const wrapper = getRenderedComponent();
wrapper.setState({ data: { result: "awesome result" }, loading: false });
});

it('set error and loading in false in <FetchComponent/>', () => {
const wrapper = getRenderedComponent();
wrapper.setState({ error: "some error", loading: false });
});

it('if no url is passed it throws an error', () => {
try {
withFetch({})(Component);
Expand All @@ -105,7 +115,7 @@ describe('Testing -> <FetchComponent/>', () => {

it('if no config is passed it throws an error', () => {
try {
withFetch({ url: '' })(Component);
withFetch({ url: '', config: null })(Component);
} catch (err) {
expect(err.message).to.equal('Config is undefined or empty. You should define config key in your options object.');
}
Expand Down

0 comments on commit 17b3ea3

Please sign in to comment.