store.test.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * <<
  3. * Davinci
  4. * ==
  5. * Copyright (C) 2016 - 2017 EDP
  6. * ==
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * >>
  19. */
  20. /**
  21. * Test store addons
  22. */
  23. import history from 'app/utils/history'
  24. import configureStore, { IWindow } from 'app/configureStore'
  25. describe('configureStore', () => {
  26. let store
  27. beforeAll(() => {
  28. store = configureStore({}, history)
  29. })
  30. describe('injectedReducers', () => {
  31. it('should contain an object for reducers', () => {
  32. expect(typeof store.injectedReducers).toBe('object')
  33. })
  34. })
  35. describe('injectedSagas', () => {
  36. it('should contain an object for sagas', () => {
  37. expect(typeof store.injectedSagas).toBe('object')
  38. })
  39. })
  40. describe('runSaga', () => {
  41. it('should contain a hook for `sagaMiddleware.run`', () => {
  42. expect(typeof store.runSaga).toBe('function')
  43. })
  44. })
  45. })
  46. declare const window: IWindow
  47. describe('configureStore params', () => {
  48. it('should call window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__', () => {
  49. /* eslint-disable no-underscore-dangle */
  50. const compose = jest.fn()
  51. window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = () => compose
  52. configureStore(undefined, history)
  53. expect(compose).toHaveBeenCalled()
  54. /* eslint-enable */
  55. })
  56. })