selectors.test.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. selectOrganization,
  22. makeSelectOrganizations,
  23. makeSelectCurrentOrganizations,
  24. makeSelectCurrentOrganizationProjects,
  25. makeSelectCurrentOrganizationProjectsDetail,
  26. makeSelectCurrentOrganizationRole,
  27. makeSelectCurrentOrganizationMembers,
  28. makeSelectInviteMemberList,
  29. makeSelectRoleModalLoading,
  30. makeSelectCurrentOrganizationProject,
  31. makeSelectCurrentOrganizationProjectAdmins,
  32. makeSelectCurrentOrganizationProjectRoles,
  33. makeSelectInviteMemberLoading
  34. } from 'app/containers/Organizations/selectors'
  35. import { initialState } from 'app/containers/Organizations/reducer'
  36. const state = {
  37. organization: initialState
  38. }
  39. describe('selectProject', () => {
  40. it('should select the org state', () => {
  41. expect(selectOrganization(state)).toEqual(state.organization)
  42. })
  43. })
  44. describe('makeSelectProjects', () => {
  45. const orgSelector = makeSelectOrganizations()
  46. const currentOrgSelector = makeSelectCurrentOrganizations()
  47. const currentOrgProsSelector = makeSelectCurrentOrganizationProjects()
  48. const currentOrgProDetailSelector = makeSelectCurrentOrganizationProjectsDetail()
  49. const currentOrgRoleSelector = makeSelectCurrentOrganizationRole()
  50. const currentOrgMemberSelector = makeSelectCurrentOrganizationMembers()
  51. const inviteMemberSelector = makeSelectInviteMemberList()
  52. const modalLoadingSelector = makeSelectRoleModalLoading()
  53. const currentOrgProSelector = makeSelectCurrentOrganizationProject()
  54. const currentOrgProAdminSelector = makeSelectCurrentOrganizationProjectAdmins()
  55. const currentOrgProRolesSelector = makeSelectCurrentOrganizationProjectRoles()
  56. const inviteMemberLoadingSelector = makeSelectInviteMemberLoading()
  57. it('should select the orgSelector', () => {
  58. expect(orgSelector(state)).toEqual(state.organization.organizations)
  59. })
  60. it('should select the currentOrgSelector', () => {
  61. expect(currentOrgSelector(state)).toEqual(
  62. state.organization.currentOrganization
  63. )
  64. })
  65. it('should select the currentOrgProsSelector', () => {
  66. expect(currentOrgProsSelector(state)).toEqual(
  67. state.organization.organizations
  68. )
  69. })
  70. it('should select the currentOrgProDetailSelector', () => {
  71. expect(currentOrgProDetailSelector(state)).toEqual(
  72. state.organization.currentOrganizationProjectsDetail
  73. )
  74. })
  75. it('should select the currentOrgRoleSelector', () => {
  76. expect(currentOrgRoleSelector(state)).toEqual(
  77. state.organization.currentOrganizationRole
  78. )
  79. })
  80. it('should select the currentOrgMemberSelector', () => {
  81. expect(currentOrgMemberSelector(state)).toEqual(
  82. state.organization.currentOrganizationMembers
  83. )
  84. })
  85. it('should select the inviteMemberSelector', () => {
  86. expect(inviteMemberSelector(state)).toEqual(
  87. state.organization.inviteMemberLists
  88. )
  89. })
  90. it('should select the modalLoadingSelector', () => {
  91. expect(modalLoadingSelector(state)).toEqual(
  92. state.organization.roleModalLoading
  93. )
  94. })
  95. it('should select the currentOrgProSelector', () => {
  96. expect(currentOrgProSelector(state)).toEqual(
  97. state.organization.projectDetail
  98. )
  99. })
  100. it('should select the currentOrgProAdminSelector', () => {
  101. expect(currentOrgProAdminSelector(state)).toEqual(
  102. state.organization.projectAdmins
  103. )
  104. })
  105. it('should select the currentOrgProRolesSelector', () => {
  106. expect(currentOrgProRolesSelector(state)).toEqual(
  107. state.organization.projectRoles
  108. )
  109. })
  110. it('should select the inviteMemberLoadingSelector', () => {
  111. expect(inviteMemberLoadingSelector(state)).toEqual(
  112. state.organization.inviteMemberfetching
  113. )
  114. })
  115. })