organizationsDetails.spec.jsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React from 'react';
  2. import {render} from 'enzyme';
  3. import {Client} from 'app/api';
  4. import OrganizationDetails from 'app/views/organizationDetails';
  5. describe('OrganizationDetails', function() {
  6. beforeEach(function() {
  7. Client.clearMockResponses();
  8. });
  9. describe('render()', function() {
  10. describe('pending deletion', () => {
  11. it('should render a restoration prompt', function() {
  12. Client.addMockResponse({
  13. url: '/organizations/org-slug/',
  14. body: TestStubs.Organization({
  15. slug: 'org-slug',
  16. status: {
  17. id: 'pending_deletion',
  18. name: 'pending deletion',
  19. },
  20. }),
  21. });
  22. let tree = render(<OrganizationDetails params={{orgId: 'org-slug'}} />);
  23. expect(tree).toMatchSnapshot();
  24. });
  25. it('should render a restoration prompt without action for members', function() {
  26. Client.addMockResponse({
  27. url: '/organizations/org-slug/',
  28. body: TestStubs.Organization({
  29. slug: 'org-slug',
  30. access: [],
  31. status: {
  32. id: 'pending_deletion',
  33. name: 'pending deletion',
  34. },
  35. }),
  36. });
  37. let tree = render(<OrganizationDetails params={{orgId: 'org-slug'}} />);
  38. expect(tree).toMatchSnapshot();
  39. });
  40. });
  41. describe('deletion in progress', () => {
  42. beforeEach(() => {
  43. Client.addMockResponse({
  44. url: '/organizations/org-slug/',
  45. body: TestStubs.Organization({
  46. slug: 'org-slug',
  47. status: {
  48. id: 'deletion_in_progress',
  49. name: 'deletion in progress',
  50. },
  51. }),
  52. });
  53. });
  54. it('should render a deletion in progress prompt', function() {
  55. let tree = render(<OrganizationDetails params={{orgId: 'org-slug'}} />);
  56. expect(tree).toMatchSnapshot();
  57. });
  58. });
  59. });
  60. });