utils.spec.tsx 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import {getCumulativeAlertLevelFromErrors} from 'sentry/components/events/interfaces/spans/utils';
  2. describe('getCumulativeAlertLevelFromErrors', () => {
  3. it('returns undefined for an empty array', () => {
  4. expect(getCumulativeAlertLevelFromErrors([])).toBeUndefined();
  5. });
  6. it('returns the alert level of the first error if only one error is provided', () => {
  7. expect(getCumulativeAlertLevelFromErrors([{level: 'error'}])).toBe('error');
  8. });
  9. it('returns the highest alert level for a set of severe errors', () => {
  10. expect(getCumulativeAlertLevelFromErrors([{level: 'fatal'}, {level: 'info'}])).toBe(
  11. 'error'
  12. );
  13. });
  14. it('returns the highest alert level for a set of non-severe errors', () => {
  15. expect(getCumulativeAlertLevelFromErrors([{level: 'warning'}, {level: 'info'}])).toBe(
  16. 'warning'
  17. );
  18. });
  19. it('returns the highest alert level for a set of info errors', () => {
  20. expect(getCumulativeAlertLevelFromErrors([{level: 'info'}, {level: 'info'}])).toBe(
  21. 'info'
  22. );
  23. });
  24. });