projectChooser.spec.jsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import React from 'react';
  2. import {shallow} from 'sentry-test/enzyme';
  3. import ProjectChooser from 'app/views/projectChooser';
  4. describe('ProjectChooser', function() {
  5. const mockOrg = {
  6. id: 'org',
  7. slug: 'org',
  8. teams: [
  9. {
  10. name: 'Test Team',
  11. slug: 'test-team',
  12. isMember: true,
  13. projects: [
  14. {
  15. slug: 'test-project',
  16. name: 'Test Project',
  17. },
  18. {
  19. slug: 'another-project',
  20. name: 'Another Project',
  21. },
  22. ],
  23. },
  24. ],
  25. projects: [
  26. {
  27. slug: 'test-project',
  28. name: 'Test Project',
  29. isMember: true,
  30. team: {
  31. name: 'Test Team',
  32. slug: 'test-team',
  33. isMember: true,
  34. projects: [
  35. {
  36. slug: 'test-project',
  37. name: 'Test Project',
  38. },
  39. {
  40. slug: 'another-project',
  41. name: 'Another Project',
  42. },
  43. ],
  44. },
  45. },
  46. {
  47. slug: 'another-project',
  48. name: 'Another Project',
  49. isMember: true,
  50. team: {
  51. name: 'Test Team',
  52. slug: 'test-team',
  53. isMember: true,
  54. projects: [
  55. {
  56. slug: 'test-project',
  57. name: 'Test Project',
  58. },
  59. {
  60. slug: 'another-project',
  61. name: 'Another Project',
  62. },
  63. ],
  64. },
  65. },
  66. ],
  67. access: [],
  68. };
  69. it('renders', function() {
  70. const wrapper = shallow(
  71. <ProjectChooser
  72. location={{
  73. pathname: 'https://sentry.io/organizations/tester1/projects/choose/',
  74. query: {onboarding: '1', task: '2'},
  75. search: '?onboarding=1&task=2',
  76. }}
  77. />,
  78. {
  79. context: {
  80. organization: mockOrg,
  81. },
  82. }
  83. );
  84. expect(wrapper).toMatchSnapshot();
  85. });
  86. });