@bufferapp/analyze-png-export
Advanced tools
Comparing version 1.33.0 to 1.38.0
14
index.js
@@ -1,17 +0,3 @@ | ||
import { connect } from 'react-redux'; | ||
import ExportButton from './components/ExportButton'; | ||
import { actions } from './reducer'; | ||
// default export = container | ||
export default connect( | ||
state => ({ | ||
exporting: state.exportToPNG.exporting, | ||
}), | ||
(dispatch, props) => ({ | ||
exportToPNG: () => dispatch(actions.exportToPNG(props.filename)), | ||
}), | ||
)(ExportButton); | ||
// export reducer, actions and action types | ||
export reducer, { actions, actionTypes } from './reducer'; | ||
export middleware from './middleware'; |
@@ -1,6 +0,4 @@ | ||
import React from 'react'; | ||
import { configure, mount, shallow } from 'enzyme'; | ||
import { configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { Provider } from 'react-redux'; | ||
import PngExport, { | ||
import { | ||
reducer, | ||
@@ -11,28 +9,6 @@ actions, | ||
} from './index'; | ||
import ExportButton from './components/ExportButton'; | ||
configure({ adapter: new Adapter() }); | ||
const storeFake = state => ({ | ||
default: () => {}, | ||
subscribe: () => {}, | ||
dispatch: () => {}, | ||
getState: () => ({ ...state }), | ||
}); | ||
describe('PngExport', () => { | ||
it('should render', () => { | ||
const store = storeFake({ | ||
exportToPNG: { | ||
exporting: false, | ||
}, | ||
}); | ||
const wrapper = mount( | ||
<Provider store={store}> | ||
<PngExport /> | ||
</Provider>, | ||
); | ||
expect(wrapper.find(ExportButton).length) | ||
.toBe(1); | ||
}); | ||
it('should export reducer', () => { | ||
@@ -57,16 +33,2 @@ expect(reducer) | ||
}); | ||
it('exportToPNG should call the exportToPNG action with the filename prop', () => { | ||
const store = { | ||
dispatch: jest.fn(), | ||
subscribe: () => {}, | ||
getState: jest.fn(() => ({ | ||
exportToPNG: {}, | ||
})), | ||
}; | ||
const component = shallow(<PngExport filename="overview" store={store} />); | ||
component.props().exportToPNG(); | ||
expect(store.dispatch).toHaveBeenCalledWith(actions.exportToPNG('overview')); | ||
}); | ||
}); |
{ | ||
"name": "@bufferapp/analyze-png-export", | ||
"version": "1.33.0", | ||
"version": "1.38.0", | ||
"description": "PNG export button", | ||
@@ -39,3 +39,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "be350de960295f73cc32ba6012b8d9bb9ba663b7" | ||
"gitHead": "a622869e2172a308b67b3487cd9a16cb809bb567" | ||
} |
112418
35
945