actions.test.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. import { ActionTypes } from 'app/containers/Organizations/constants'
  2. import actions from 'app/containers/Organizations/actions'
  3. import { mockStore } from './fixtures'
  4. describe('Organizations Actions', () => {
  5. const {
  6. orgId,
  7. projects,
  8. member,
  9. members,
  10. role,
  11. roles,
  12. resolve,
  13. organization,
  14. organizations
  15. } = mockStore
  16. describe('loadOrganizationProjects', () => {
  17. it(' loadOrganizationProjects should return the correct type', () => {
  18. const expectedResult = {
  19. type: ActionTypes.LOAD_ORGANIZATIONS_PROJECTS,
  20. payload: {
  21. param: orgId
  22. }
  23. }
  24. expect(actions.loadOrganizationProjects(orgId)).toEqual(expectedResult)
  25. })
  26. })
  27. describe('organizationsProjectsLoaded', () => {
  28. it('organizationsProjectsLoaded should return the correct type', () => {
  29. const expectedResult = {
  30. type: ActionTypes.LOAD_ORGANIZATIONS_PROJECTS_SUCCESS,
  31. payload: {
  32. projects
  33. }
  34. }
  35. expect(actions.organizationsProjectsLoaded(projects)).toEqual(
  36. expectedResult
  37. )
  38. })
  39. })
  40. describe('loadOrganizationsProjectsFail', () => {
  41. it('loadOrganizationsProjectsFail should return the correct type', () => {
  42. const expectedResult = {
  43. type: ActionTypes.LOAD_ORGANIZATIONS_PROJECTS_FAILURE
  44. }
  45. expect(actions.loadOrganizationsProjectsFail()).toEqual(expectedResult)
  46. })
  47. })
  48. describe('loadOrganizationMembers', () => {
  49. it('loadOrganizationMembers should return the correct type', () => {
  50. const expectedResult = {
  51. type: ActionTypes.LOAD_ORGANIZATIONS_MEMBERS,
  52. payload: {
  53. id: orgId
  54. }
  55. }
  56. expect(actions.loadOrganizationMembers(orgId)).toEqual(expectedResult)
  57. })
  58. })
  59. describe('organizationsMembersLoaded', () => {
  60. it('organizationsMembersLoaded should return the correct type', () => {
  61. const expectedResult = {
  62. type: ActionTypes.LOAD_ORGANIZATIONS_MEMBERS_SUCCESS,
  63. payload: {
  64. members
  65. }
  66. }
  67. expect(actions.organizationsMembersLoaded(members)).toEqual(
  68. expectedResult
  69. )
  70. })
  71. })
  72. describe('loadOrganizationsMembersFail', () => {
  73. it('loadOrganizationsMembersFail should return the correct type', () => {
  74. const expectedResult = {
  75. type: ActionTypes.LOAD_ORGANIZATIONS_MEMBERS_FAILURE
  76. }
  77. expect(actions.loadOrganizationsMembersFail()).toEqual(expectedResult)
  78. })
  79. })
  80. describe('loadOrganizationRole', () => {
  81. it('loadOrganizationRole should return the correct type', () => {
  82. const expectedResult = {
  83. type: ActionTypes.LOAD_ORGANIZATIONS_ROLE,
  84. payload: {
  85. id: orgId
  86. }
  87. }
  88. expect(actions.loadOrganizationRole(orgId)).toEqual(expectedResult)
  89. })
  90. })
  91. describe('organizationsRoleLoaded', () => {
  92. it('organizationsRoleLoaded should return the correct type', () => {
  93. const expectedResult = {
  94. type: ActionTypes.LOAD_ORGANIZATIONS_ROLE_SUCCESS,
  95. payload: {
  96. role
  97. }
  98. }
  99. expect(actions.organizationsRoleLoaded(role)).toEqual(expectedResult)
  100. })
  101. })
  102. describe('loadOrganizationsRoleFail', () => {
  103. it('loadOrganizationsRoleFail should return the correct type', () => {
  104. const expectedResult = {
  105. type: ActionTypes.LOAD_ORGANIZATIONS_ROLE_FAILURE,
  106. payload: {}
  107. }
  108. expect(actions.loadOrganizationsRoleFail()).toEqual(expectedResult)
  109. })
  110. })
  111. describe('loadOrganizations', () => {
  112. it('loadOrganizations should return the correct type', () => {
  113. const expectedResult = {
  114. type: ActionTypes.LOAD_ORGANIZATIONS
  115. }
  116. expect(actions.loadOrganizations()).toEqual(expectedResult)
  117. })
  118. })
  119. describe('organizationsLoaded', () => {
  120. it('organizationsLoaded should return the correct type', () => {
  121. const expectedResult = {
  122. type: ActionTypes.LOAD_ORGANIZATIONS_SUCCESS,
  123. payload: {
  124. organizations
  125. }
  126. }
  127. expect(actions.organizationsLoaded(organizations)).toEqual(expectedResult)
  128. })
  129. })
  130. describe('loadOrganizationsFail', () => {
  131. it('loadOrganizationsFail should return the correct type', () => {
  132. const expectedResult = {
  133. type: ActionTypes.LOAD_ORGANIZATIONS_FAILURE,
  134. payload: {}
  135. }
  136. expect(actions.loadOrganizationsFail()).toEqual(expectedResult)
  137. })
  138. })
  139. describe('addOrganization', () => {
  140. it('addOrganization should return the correct type', () => {
  141. const expectedResult = {
  142. type: ActionTypes.ADD_ORGANIZATION,
  143. payload: {
  144. organization,
  145. resolve
  146. }
  147. }
  148. expect(actions.addOrganization(organization, resolve)).toEqual(
  149. expectedResult
  150. )
  151. })
  152. })
  153. describe('organizationAdded', () => {
  154. it('organizationAdded should return the correct type', () => {
  155. const expectedResult = {
  156. type: ActionTypes.ADD_ORGANIZATION_SUCCESS,
  157. payload: {
  158. result: organization
  159. }
  160. }
  161. expect(actions.organizationAdded(organization)).toEqual(expectedResult)
  162. })
  163. })
  164. describe('addOrganizationFail', () => {
  165. it('addOrganizationFail should return the correct type', () => {
  166. const expectedResult = {
  167. type: ActionTypes.ADD_ORGANIZATION_FAILURE,
  168. payload: {}
  169. }
  170. expect(actions.addOrganizationFail()).toEqual(expectedResult)
  171. })
  172. })
  173. describe('editOrganization', () => {
  174. it('editOrganization should return the correct type', () => {
  175. const expectedResult = {
  176. type: ActionTypes.EDIT_ORGANIZATION,
  177. payload: { organization }
  178. }
  179. expect(actions.editOrganization(organization)).toEqual(expectedResult)
  180. })
  181. })
  182. describe('organizationEdited', () => {
  183. it('organizationEdited should return the correct type', () => {
  184. const expectedResult = {
  185. type: ActionTypes.EDIT_ORGANIZATION_SUCCESS,
  186. payload: {
  187. result: organization
  188. }
  189. }
  190. expect(actions.organizationEdited(organization)).toEqual(expectedResult)
  191. })
  192. })
  193. describe('editOrganizationFail', () => {
  194. it('editOrganizationFail should return the correct type', () => {
  195. const expectedResult = {
  196. type: ActionTypes.EDIT_ORGANIZATION_FAILURE,
  197. payload: {}
  198. }
  199. expect(actions.editOrganizationFail()).toEqual(expectedResult)
  200. })
  201. })
  202. describe('deleteOrganization', () => {
  203. it('deleteOrganization should return the correct type', () => {
  204. const expectedResult = {
  205. type: ActionTypes.DELETE_ORGANIZATION,
  206. payload: {
  207. id: orgId,
  208. resolve
  209. }
  210. }
  211. expect(actions.deleteOrganization(orgId, resolve)).toEqual(expectedResult)
  212. })
  213. })
  214. describe('organizationDeleted', () => {
  215. it('organizationDeleted should return the correct type', () => {
  216. const expectedResult = {
  217. type: ActionTypes.DELETE_ORGANIZATION_SUCCESS,
  218. payload: {
  219. id: orgId
  220. }
  221. }
  222. expect(actions.organizationDeleted(orgId)).toEqual(expectedResult)
  223. })
  224. })
  225. describe('deleteOrganizationFail', () => {
  226. it('deleteOrganizationFail should return the correct type', () => {
  227. const expectedResult = {
  228. type: ActionTypes.DELETE_ORGANIZATION_FAILURE,
  229. payload: {}
  230. }
  231. expect(actions.deleteOrganizationFail()).toEqual(expectedResult)
  232. })
  233. })
  234. describe('loadOrganizationDetail', () => {
  235. it('loadOrganizationDetail should return the correct type', () => {
  236. const expectedResult = {
  237. type: ActionTypes.LOAD_ORGANIZATION_DETAIL,
  238. payload: {
  239. id: orgId
  240. }
  241. }
  242. expect(actions.loadOrganizationDetail(orgId)).toEqual(expectedResult)
  243. })
  244. })
  245. describe('organizationDetailLoaded', () => {
  246. it('organizationDetailLoaded should return the correct type', () => {
  247. const expectedResult = {
  248. type: ActionTypes.LOAD_ORGANIZATION_DETAIL_SUCCESS,
  249. payload: { organization }
  250. }
  251. expect(actions.organizationDetailLoaded(organization)).toEqual(
  252. expectedResult
  253. )
  254. })
  255. })
  256. describe('loadOrganizationDetailFail', () => {
  257. it('loadOrganizationDetailFail should return the correct type', () => {
  258. const expectedResult = {
  259. type: ActionTypes.LOAD_ORGANIZATION_DETAIL_FAILURE,
  260. payload: {
  261. organization,
  262. widgets: ''
  263. }
  264. }
  265. expect(actions.loadOrganizationDetailFail(organization, '')).toEqual(
  266. expectedResult
  267. )
  268. })
  269. })
  270. describe('addRole', () => {
  271. it('addRole should return the correct type', () => {
  272. const expectedResult = {
  273. type: ActionTypes.ADD_ROLE,
  274. payload: {
  275. name: role.name,
  276. id: role.id,
  277. description: role.description,
  278. resolve
  279. }
  280. }
  281. expect(
  282. actions.addRole(role.name, role.description, role.id, resolve)
  283. ).toEqual(expectedResult)
  284. })
  285. })
  286. describe('roleAdded', () => {
  287. it('roleAdded should return the correct type', () => {
  288. const expectedResult = {
  289. type: ActionTypes.ADD_ROLE_SUCCESS,
  290. payload: {
  291. result: role
  292. }
  293. }
  294. expect(actions.roleAdded(role)).toEqual(expectedResult)
  295. })
  296. })
  297. describe('addRoleFail', () => {
  298. it('addRoleFail should return the correct type', () => {
  299. const expectedResult = { type: ActionTypes.ADD_ROLE_FAILURE, payload: {} }
  300. expect(actions.addRoleFail()).toEqual(expectedResult)
  301. })
  302. })
  303. describe('deleteRole', () => {
  304. it('deleteRole should return the correct type', () => {
  305. const expectedResult = {
  306. type: ActionTypes.DELETE_ROLE,
  307. payload: {
  308. id: orgId,
  309. resolve
  310. }
  311. }
  312. expect(actions.deleteRole(orgId, resolve)).toEqual(expectedResult)
  313. })
  314. })
  315. describe('roleDeleted', () => {
  316. it('roleDeleted should return the correct type', () => {
  317. const expectedResult = {
  318. type: ActionTypes.DELETE_ROLE_SUCCESS,
  319. payload: {
  320. result: role
  321. }
  322. }
  323. expect(actions.roleDeleted(role)).toEqual(expectedResult)
  324. })
  325. })
  326. describe('deleteRoleFail', () => {
  327. it('deleteRoleFail should return the correct type', () => {
  328. const expectedResult = {
  329. type: ActionTypes.DELETE_ROLE_FAILURE,
  330. payload: {}
  331. }
  332. expect(actions.deleteRoleFail()).toEqual(expectedResult)
  333. })
  334. })
  335. describe('editRole', () => {
  336. it('editRole should return the correct type', () => {
  337. const expectedResult = {
  338. type: ActionTypes.EDIT_ROLE,
  339. payload: {
  340. name: role.name,
  341. id: role.id,
  342. description: role.description,
  343. resolve
  344. }
  345. }
  346. expect(
  347. actions.editRole(role.name, role.description, role.id, resolve)
  348. ).toEqual(expectedResult)
  349. })
  350. })
  351. describe('roleEdited', () => {
  352. it('roleEdited should return the correct type', () => {
  353. const expectedResult = {
  354. type: ActionTypes.EDIT_ROLE_SUCCESS,
  355. payload: {
  356. result: role
  357. }
  358. }
  359. expect(actions.roleEdited(role)).toEqual(expectedResult)
  360. })
  361. })
  362. describe('editRoleFail', () => {
  363. it('editRoleFail should return the correct type', () => {
  364. const expectedResult = {
  365. type: ActionTypes.EDIT_ROLE_FAILURE,
  366. payload: {}
  367. }
  368. expect(actions.editRoleFail()).toEqual(expectedResult)
  369. })
  370. })
  371. describe('searchMember', () => {
  372. it('searchMember should return the correct type', () => {
  373. const expectedResult = {
  374. type: ActionTypes.SEARCH_MEMBER,
  375. payload: {
  376. keyword: ''
  377. }
  378. }
  379. expect(actions.searchMember('')).toEqual(expectedResult)
  380. })
  381. })
  382. describe('memberSearched', () => {
  383. it('memberSearched should return the correct type', () => {
  384. const expectedResult = {
  385. type: ActionTypes.SEARCH_MEMBER_SUCCESS,
  386. payload: {
  387. result: member
  388. }
  389. }
  390. expect(actions.memberSearched(member)).toEqual(expectedResult)
  391. })
  392. })
  393. describe('searchMemberFail', () => {
  394. it('searchMemberFail should return the correct type', () => {
  395. const expectedResult = {
  396. type: ActionTypes.SEARCH_MEMBER_FAILURE,
  397. payload: {}
  398. }
  399. expect(actions.searchMemberFail()).toEqual(expectedResult)
  400. })
  401. })
  402. describe('inviteMember', () => {
  403. it('inviteMember should return the correct type', () => {
  404. const expectedResult = {
  405. type: ActionTypes.INVITE_MEMBER,
  406. payload: {
  407. orgId,
  408. members,
  409. needEmail: false,
  410. resolve
  411. }
  412. }
  413. expect(actions.inviteMember(orgId, members, false, resolve)).toEqual(
  414. expectedResult
  415. )
  416. })
  417. })
  418. describe('inviteMemberSuccess', () => {
  419. it('inviteMemberSuccess should return the correct type', () => {
  420. const expectedResult = {
  421. type: ActionTypes.INVITE_MEMBER_SUCCESS,
  422. payload: {
  423. result: member
  424. }
  425. }
  426. expect(actions.inviteMemberSuccess(member)).toEqual(expectedResult)
  427. })
  428. })
  429. describe('inviteMemberFail', () => {
  430. it('inviteMemberFail should return the correct type', () => {
  431. const expectedResult = {
  432. type: ActionTypes.INVITE_MEMBER_FAILURE,
  433. payload: {}
  434. }
  435. expect(actions.inviteMemberFail()).toEqual(expectedResult)
  436. })
  437. })
  438. describe('deleteOrganizationMember', () => {
  439. it('deleteOrganizationMember should return the correct type', () => {
  440. const expectedResult = {
  441. type: ActionTypes.DELETE_ORGANIZATION_MEMBER,
  442. payload: {
  443. relationId: orgId,
  444. resolve
  445. }
  446. }
  447. expect(actions.deleteOrganizationMember(orgId, resolve)).toEqual(
  448. expectedResult
  449. )
  450. })
  451. })
  452. describe('organizationMemberDeleted', () => {
  453. it('organizationMemberDeleted should return the correct type', () => {
  454. const expectedResult = {
  455. type: ActionTypes.DELETE_ORGANIZATION_MEMBER_SUCCESS,
  456. payload: {
  457. id: orgId
  458. }
  459. }
  460. expect(actions.organizationMemberDeleted(orgId)).toEqual(expectedResult)
  461. })
  462. })
  463. describe('deleteOrganizationMemberFail', () => {
  464. it('deleteOrganizationMemberFail should return the correct type', () => {
  465. const expectedResult = {
  466. type: ActionTypes.DELETE_ORGANIZATION_MEMBER_ERROR,
  467. payload: {}
  468. }
  469. expect(actions.deleteOrganizationMemberFail()).toEqual(expectedResult)
  470. })
  471. })
  472. describe('changeOrganizationMemberRole', () => {
  473. it('changeOrganizationMemberRole should return the correct type', () => {
  474. const expectedResult = {
  475. type: ActionTypes.CHANGE_MEMBER_ROLE_ORGANIZATION,
  476. payload: {
  477. relationId: orgId,
  478. newRole: role,
  479. resolve
  480. }
  481. }
  482. expect(
  483. actions.changeOrganizationMemberRole(orgId, role, resolve)
  484. ).toEqual(expectedResult)
  485. })
  486. })
  487. describe('organizationMemberRoleChanged', () => {
  488. it('organizationMemberRoleChanged should return the correct type', () => {
  489. const expectedResult = {
  490. type: ActionTypes.CHANGE_MEMBER_ROLE_ORGANIZATION_SUCCESS,
  491. payload: {
  492. relationId: orgId,
  493. newRole: role
  494. }
  495. }
  496. expect(actions.organizationMemberRoleChanged(orgId, role)).toEqual(
  497. expectedResult
  498. )
  499. })
  500. })
  501. describe('changeOrganizationMemberRoleFail', () => {
  502. it('changeOrganizationMemberRoleFail should return the correct type', () => {
  503. const expectedResult = {
  504. type: ActionTypes.CHANGE_MEMBER_ROLE_ORGANIZATION_ERROR,
  505. payload: {}
  506. }
  507. expect(actions.changeOrganizationMemberRoleFail()).toEqual(expectedResult)
  508. })
  509. })
  510. describe('relRoleMember', () => {
  511. it('relRoleMember should return the correct type', () => {
  512. const expectedResult = {
  513. type: ActionTypes.REL_ROLE_MEMBER,
  514. payload: {
  515. id: orgId,
  516. memberIds: [1, 2],
  517. resolve
  518. }
  519. }
  520. expect(actions.relRoleMember(orgId, [1, 2], resolve)).toEqual(
  521. expectedResult
  522. )
  523. })
  524. })
  525. describe('relRoleMemberSuccess', () => {
  526. it('relRoleMemberSuccess should return the correct type', () => {
  527. const expectedResult = {
  528. type: ActionTypes.REL_ROLE_MEMBER_SUCCESS,
  529. payload: {}
  530. }
  531. expect(actions.relRoleMemberSuccess()).toEqual(expectedResult)
  532. })
  533. })
  534. describe('relRoleMemberFail', () => {
  535. it('relRoleMemberFail should return the correct type', () => {
  536. const expectedResult = {
  537. type: ActionTypes.REL_ROLE_MEMBER_FAILURE,
  538. payload: {}
  539. }
  540. expect(actions.relRoleMemberFail()).toEqual(expectedResult)
  541. })
  542. })
  543. describe('getRelRoleMember', () => {
  544. it('getRelRoleMember should return the correct type', () => {
  545. const expectedResult = {
  546. type: ActionTypes.GET_REL_ROLE_MEMBER,
  547. payload: {
  548. id: orgId,
  549. resolve
  550. }
  551. }
  552. expect(actions.getRelRoleMember(orgId, resolve)).toEqual(expectedResult)
  553. })
  554. })
  555. describe('getRelRoleMemberSuccess', () => {
  556. it('getRelRoleMemberSuccess should return the correct type', () => {
  557. const expectedResult = {
  558. type: ActionTypes.GET_REL_ROLE_MEMBER_SUCCESS,
  559. payload: {}
  560. }
  561. expect(actions.getRelRoleMemberSuccess()).toEqual(expectedResult)
  562. })
  563. })
  564. describe('getRelRoleMemberFail', () => {
  565. it('getRelRoleMemberFail should return the correct type', () => {
  566. const expectedResult = {
  567. type: ActionTypes.GET_REL_ROLE_MEMBER_FAILURE,
  568. payload: {}
  569. }
  570. expect(actions.getRelRoleMemberFail()).toEqual(expectedResult)
  571. })
  572. })
  573. describe('setCurrentProject', () => {
  574. it('setCurrentProject should return the correct type', () => {
  575. const expectedResult = {
  576. type: ActionTypes.SET_CURRENT_ORIGANIZATION_PROJECT,
  577. payload: {
  578. option: {}
  579. }
  580. }
  581. expect(actions.setCurrentProject({})).toEqual(expectedResult)
  582. })
  583. })
  584. describe('loadProjectAdmin', () => {
  585. it('loadProjectAdmin should return the correct type', () => {
  586. const expectedResult = {
  587. type: ActionTypes.LOAD_PROJECT_ADMINS,
  588. payload: {
  589. projectId: orgId
  590. }
  591. }
  592. expect(actions.loadProjectAdmin(orgId)).toEqual(expectedResult)
  593. })
  594. })
  595. describe('projectAdminLoaded', () => {
  596. it('projectAdminLoaded should return the correct type', () => {
  597. const expectedResult = {
  598. type: ActionTypes.LOAD_PROJECT_ADMINS_SUCCESS,
  599. payload: {
  600. result: projects
  601. }
  602. }
  603. expect(actions.projectAdminLoaded(projects)).toEqual(expectedResult)
  604. })
  605. })
  606. describe('loadProjectAdminFail', () => {
  607. it('loadProjectAdminFail should return the correct type', () => {
  608. const expectedResult = {
  609. type: ActionTypes.LOAD_PROJECT_ADMINS_FAIL,
  610. payload: {}
  611. }
  612. expect(actions.loadProjectAdminFail()).toEqual(expectedResult)
  613. })
  614. })
  615. describe('loadProjectRoles', () => {
  616. it('loadProjectRoles should return the correct type', () => {
  617. const expectedResult = {
  618. type: ActionTypes.LOAD_PROJECT_ROLES,
  619. payload: {
  620. projectId: orgId
  621. }
  622. }
  623. expect(actions.loadProjectRoles(orgId)).toEqual(expectedResult)
  624. })
  625. })
  626. describe('projectRolesLoaded', () => {
  627. it('projectRolesLoaded should return the correct type', () => {
  628. const expectedResult = {
  629. type: ActionTypes.LOAD_PROJECT_ROLES_SUCCESS,
  630. payload: {
  631. result: roles
  632. }
  633. }
  634. expect(actions.projectRolesLoaded(roles)).toEqual(expectedResult)
  635. })
  636. })
  637. describe('loadProjectRolesFail', () => {
  638. it('loadProjectRolesFail should return the correct type', () => {
  639. const expectedResult = {
  640. type: ActionTypes.LOAD_PROJECT_ROLES_FAIL,
  641. payload: {}
  642. }
  643. expect(actions.loadProjectRolesFail()).toEqual(expectedResult)
  644. })
  645. })
  646. describe('getVizVisbility', () => {
  647. it('getVizVisbility should return the correct type', () => {
  648. const expectedResult = {
  649. type: ActionTypes.GET_VIZ_VISBILITY,
  650. payload: {
  651. roleId: orgId,
  652. projectId: orgId,
  653. resolve
  654. }
  655. }
  656. expect(actions.getVizVisbility(orgId, orgId, resolve)).toEqual(
  657. expectedResult
  658. )
  659. })
  660. })
  661. describe('postVizVisbility', () => {
  662. it('postVizVisbility should return the correct type', () => {
  663. const expectedResult = {
  664. type: ActionTypes.POST_VIZ_VISBILITY,
  665. payload: {
  666. id: orgId,
  667. resolve,
  668. permission: []
  669. }
  670. }
  671. expect(actions.postVizVisbility(orgId, [], resolve)).toEqual(
  672. expectedResult
  673. )
  674. })
  675. })
  676. describe('getRoleListByMemberId', () => {
  677. it('getRoleListByMemberId should return the correct type', () => {
  678. const expectedResult = {
  679. type: ActionTypes.GET_ROLELISTS_BY_MEMBERID,
  680. payload: {
  681. orgId,
  682. memberId: orgId,
  683. resolve
  684. }
  685. }
  686. expect(actions.getRoleListByMemberId(orgId, orgId, resolve)).toEqual(
  687. expectedResult
  688. )
  689. })
  690. })
  691. describe('getRoleListByMemberIdSuccess', () => {
  692. it('getRoleListByMemberIdSuccess should return the correct type', () => {
  693. const expectedResult = {
  694. type: ActionTypes.GET_ROLELISTS_BY_MEMBERID_SUCCESS,
  695. payload: {
  696. result: member,
  697. memberId: orgId
  698. }
  699. }
  700. expect(actions.getRoleListByMemberIdSuccess(member, orgId)).toEqual(
  701. expectedResult
  702. )
  703. })
  704. })
  705. describe('getRoleListByMemberIdFail', () => {
  706. it('getRoleListByMemberIdFail should return the correct type', () => {
  707. const expectedResult = {
  708. type: ActionTypes.GET_ROLELISTS_BY_MEMBERID_ERROR,
  709. payload: {
  710. error: 'error',
  711. memberId: orgId
  712. }
  713. }
  714. expect(actions.getRoleListByMemberIdFail('error', orgId)).toEqual(
  715. expectedResult
  716. )
  717. })
  718. })
  719. })