projectDebugFiles.spec.jsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import {shallow, mount} from 'sentry-test/enzyme';
  3. import {Client} from 'app/api';
  4. import ProjectDebugFiles from 'app/views/settings/projectDebugFiles';
  5. const ENDPOINT = '/projects/org/project/files/dsyms/';
  6. describe('ProjectDebugFiles', function() {
  7. beforeEach(function() {
  8. Client.clearMockResponses();
  9. Client.addMockResponse({
  10. url: '/projects/org/project/',
  11. body: {},
  12. });
  13. });
  14. it('renders empty', function() {
  15. Client.addMockResponse({
  16. url: ENDPOINT,
  17. body: [],
  18. });
  19. const wrapper = shallow(
  20. <ProjectDebugFiles
  21. params={{orgId: 'org', projectId: 'project'}}
  22. location={{query: {}}}
  23. />,
  24. TestStubs.routerContext()
  25. );
  26. expect(wrapper).toMatchSnapshot();
  27. });
  28. it('renders', function() {
  29. Client.addMockResponse({
  30. url: ENDPOINT,
  31. body: TestStubs.DebugSymbols(),
  32. });
  33. Client.addMockResponse({
  34. url: ENDPOINT,
  35. method: 'PUT',
  36. });
  37. const wrapper = mount(
  38. <ProjectDebugFiles
  39. params={{orgId: 'org', projectId: 'project'}}
  40. location={{query: {}}}
  41. />,
  42. TestStubs.routerContext()
  43. );
  44. expect(wrapper).toMatchSnapshot();
  45. });
  46. });