Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
walexnelson committed Jun 23, 2017
1 parent 58ca20f commit dc1736f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
21 changes: 16 additions & 5 deletions app/containers/Data/data.container.spec.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import Container from './home.container';

import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import Container from './data.container';

function setup() {
const component = shallow(<Container />);
const mockStore = configureMockStore([thunk]);
const storeStateMock = {
data: {
isLoading: false,
datasets: [],
},
};


const store = mockStore(storeStateMock);
const component = shallow(<Container store={store}><span /></Container>).shallow();
return {
component
};
}

describe('(Container): Home', () => {
describe('(Container): Data', () => {
it('should render', () => {
const { component } = setup();
expect(component.first().type()).to.equal('h1');
expect(component.first().type()).to.equal('div');
});
});
2 changes: 1 addition & 1 deletion app/containers/Home/home.container.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ function setup() {
describe('(Container): Home', () => {
it('should render', () => {
const { component } = setup();
expect(component.first().type()).to.equal('h1');
expect(component.first().type()).to.equal('div');
});
});
6 changes: 1 addition & 5 deletions app/utils/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ const service = {
listDatasets: (event, { sort, limit, offset }) => {
service.getActiveSession().datasets
.list(sort, limit, offset)
.then(res => {
console.log('ListDataset', res);
event.sender.send('DATASETS:LIST:SUCCESS', res);
return res;
})
.then(res => event.sender.send('DATASETS:LIST:SUCCESS', res))
.catch(err => event.sender.send('DATASETS:LIST:FAILED', err));
}
};
Expand Down

0 comments on commit dc1736f

Please sign in to comment.