content.spec.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import Content from 'sentry/views/settings/components/dataScrubbing/content';
  3. import convertRelayPiiConfig from 'sentry/views/settings/components/dataScrubbing/convertRelayPiiConfig';
  4. const relayPiiConfig = TestStubs.DataScrubbingRelayPiiConfig();
  5. const stringRelayPiiConfig = JSON.stringify(relayPiiConfig);
  6. const convertedRules = convertRelayPiiConfig(stringRelayPiiConfig);
  7. const handleEditRule = jest.fn();
  8. const handleDelete = jest.fn();
  9. describe('Content', () => {
  10. it('default render - empty', () => {
  11. const wrapper = mountWithTheme(
  12. <Content rules={[]} onEditRule={handleEditRule} onDeleteRule={handleDelete} />
  13. );
  14. expect(wrapper.text()).toEqual('You have no data scrubbing rules');
  15. });
  16. it('render rules', () => {
  17. const wrapper = mountWithTheme(
  18. <Content
  19. rules={convertedRules}
  20. onEditRule={handleEditRule}
  21. onDeleteRule={handleDelete}
  22. />
  23. );
  24. expect(wrapper.find('List')).toHaveLength(1);
  25. });
  26. });