selectors.test.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. import {
  21. selectSchedule,
  22. makeSelectSchedules,
  23. makeSelectEditingSchedule,
  24. makeSelectLoading,
  25. makeSelectSuggestMails,
  26. makeSelectPortalDashboards,
  27. makeSelectVizs
  28. } from 'app/containers/Schedule/selectors'
  29. import { initialState } from 'app/containers/Schedule/reducer'
  30. const state = {
  31. schedule: initialState
  32. }
  33. describe('selectProject', () => {
  34. it('should select the projects state', () => {
  35. expect(selectSchedule(state)).toEqual(state.schedule)
  36. })
  37. })
  38. describe('makeSelectProjects', () => {
  39. const scheduleSelector = makeSelectSchedules()
  40. const editingScheduleSelector = makeSelectEditingSchedule()
  41. const loadingSelector = makeSelectLoading()
  42. const suggestMailsSelector = makeSelectSuggestMails()
  43. const portalDashboardSelector = makeSelectPortalDashboards()
  44. const vizsSelector = makeSelectVizs()
  45. it('should select the scheduleSelector', () => {
  46. expect(scheduleSelector(state)).toEqual(state.schedule.schedules)
  47. })
  48. it('should select the editingScheduleSelector', () => {
  49. expect(editingScheduleSelector(state)).toEqual(
  50. state.schedule.editingSchedule
  51. )
  52. })
  53. it('should select the loadingSelector', () => {
  54. expect(loadingSelector(state)).toEqual(state.schedule.loading)
  55. })
  56. it('should select the suggestMailsSelector', () => {
  57. expect(suggestMailsSelector(state)).toEqual(state.schedule.suggestMails)
  58. })
  59. it('should select the portalDashboardSelector', () => {
  60. expect(portalDashboardSelector(state)).toEqual(
  61. state.schedule.portalDashboards
  62. )
  63. })
  64. it('should select the vizsSelector', () => {
  65. expect(vizsSelector(state)).toEqual(state.schedule.vizs)
  66. })
  67. })