Merge "Return store object instead of a function"

This commit is contained in:
Zuul 2019-06-26 16:12:44 +00:00 committed by Gerrit Code Review
commit 0550dd0363
4 changed files with 6 additions and 13 deletions

View File

@ -20,7 +20,7 @@ import { Link, BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'
import { fetchInfoIfNeeded } from './actions/info'
import createZuulStore from './store'
import store from './store'
import App from './App'
import TenantsPage from './pages/Tenants'
import StatusPage from './pages/Status'
@ -35,7 +35,6 @@ api.fetchConfigErrors.mockImplementation(() => Promise.resolve({data: []}))
it('renders without crashing', () => {
const div = document.createElement('div')
const store = createZuulStore()
ReactDOM.render(<Provider store={store}><Router><App /></Router></Provider>,
div)
ReactDOM.unmountComponentAtNode(div)
@ -50,7 +49,6 @@ it('renders multi tenant', () => {
api.fetchTenants.mockImplementation(
() => Promise.resolve({data: [{name: 'openstack'}]})
)
const store = createZuulStore()
const application = ReactTestUtils.renderIntoDocument(
<Provider store={store}><Router><App /></Router></Provider>
)
@ -81,7 +79,6 @@ it('renders single tenant', () => {
api.fetchStatus.mockImplementation(
() => Promise.resolve({data: {pipelines: []}})
)
const store = createZuulStore()
const application = ReactTestUtils.renderIntoDocument(
<Provider store={store}><Router><App /></Router></Provider>
)

View File

@ -19,7 +19,7 @@ import { Link, BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'
import { setTenantAction } from '../../actions/tenant'
import createZuulStore from '../../store'
import store from '../../store'
import ChangePanel from './ChangePanel'
@ -33,7 +33,6 @@ const fakeChange = {
}
it('change panel render multi tenant links', () => {
const store = createZuulStore()
store.dispatch(setTenantAction('tenant-one', false))
const application = ReactTestUtils.renderIntoDocument(
<Provider store={store}>
@ -49,7 +48,6 @@ it('change panel render multi tenant links', () => {
})
it('change panel render white-label tenant links', () => {
const store = createZuulStore()
store.dispatch(setTenantAction('tenant-one', true))
const application = ReactTestUtils.renderIntoDocument(
<Provider store={store}>

View File

@ -26,11 +26,9 @@ import './index.css'
import { getHomepageUrl } from './api'
import registerServiceWorker from './registerServiceWorker'
import { fetchInfoIfNeeded } from './actions/info'
import createZuulStore from './store'
import store from './store'
import App from './App'
const store = createZuulStore()
// Load info endpoint
store.dispatch(fetchInfoIfNeeded())

View File

@ -17,6 +17,6 @@ import thunk from 'redux-thunk'
import appReducers from './reducers'
export default function createZuulStore() {
return createStore(appReducers, applyMiddleware(thunk))
}
const store = createStore(appReducers, applyMiddleware(thunk))
export default store