state.spec.jsx 786 B

1234567891011121314151617181920212223242526272829303132333435
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import StateContextType from 'sentry/components/events/contexts/state';
  3. const STATE_CONTEXT = {
  4. type: 'state',
  5. state: {
  6. type: 'redux',
  7. value: {
  8. a: 'abc',
  9. },
  10. },
  11. otherState: {
  12. value: {
  13. b: 'bcd',
  14. },
  15. },
  16. };
  17. describe('StateContext', function () {
  18. it('renders', () => {
  19. const wrapper = mountWithTheme(
  20. <StateContextType alias="state" data={STATE_CONTEXT} />
  21. );
  22. const keys = wrapper.find('TableSubject.key');
  23. const values = wrapper.find('.val');
  24. expect(keys.at(0).text()).toEqual('State (Redux)');
  25. expect(keys.at(1).text()).toEqual('otherState');
  26. expect(values.at(0).text()).toEqual('{a: abc}');
  27. expect(values.at(1).text()).toEqual('{b: bcd}');
  28. });
  29. });