selectors.test.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. selectProject,
  22. makeSelectProjects,
  23. makeSelectCurrentProject,
  24. makeSelectSearchProject,
  25. makeSelectStarUserList,
  26. makeSelectCollectProjects,
  27. makeSelectCurrentProjectRole,
  28. makeSelectProjectRoles
  29. } from 'app/containers/Projects/selectors'
  30. import { initialState } from 'app/containers/Projects/reducer'
  31. const state = {
  32. projects: initialState
  33. }
  34. describe('selectProject', () => {
  35. it('should select the projects state', () => {
  36. expect(selectProject(state)).toEqual(state.projects)
  37. })
  38. })
  39. describe('makeSelectProjects', () => {
  40. const projectsSelector = makeSelectProjects()
  41. const currentProjectSelector = makeSelectCurrentProject()
  42. const searchProjectsSelector = makeSelectSearchProject()
  43. const starUserListSelector = makeSelectStarUserList()
  44. const collectProjectsSelector = makeSelectCollectProjects()
  45. const currentProjectsRoleSelector = makeSelectCurrentProjectRole()
  46. const projectRolesSelector = makeSelectProjectRoles()
  47. it('should select the projects', () => {
  48. expect(projectsSelector(state)).toEqual(state.projects.projects)
  49. })
  50. it('should select the currentProjectSelector', () => {
  51. expect(currentProjectSelector(state)).toEqual(state.projects.currentProject)
  52. })
  53. it('should select the searchProjectsSelector', () => {
  54. expect(searchProjectsSelector(state)).toEqual(state.projects.searchProject)
  55. })
  56. it('should select the starUserListSelector', () => {
  57. expect(starUserListSelector(state)).toEqual(state.projects.starUserList)
  58. })
  59. it('should select the collectProjectsSelector', () => {
  60. expect(collectProjectsSelector(state)).toEqual(
  61. state.projects.collectProjects
  62. )
  63. })
  64. it('should select the currentProjectsRoleSelector', () => {
  65. expect(currentProjectsRoleSelector(state)).toEqual(
  66. state.projects.currentProjectRole
  67. )
  68. })
  69. it('should select the projectRolesSelector', () => {
  70. expect(projectRolesSelector(state)).toEqual(state.projects.projectRoles)
  71. })
  72. })