metricSearchBar.spec.tsx 859 B

12345678910111213141516171819202122232425262728
  1. import {ensureQuotedTextFilters} from 'sentry/views/metrics/metricSearchBar';
  2. describe('ensureQuotedTextFilters', () => {
  3. it('returns a query with all text filters quoted', () => {
  4. expect(ensureQuotedTextFilters('transaction:/{organization_slug}/')).toEqual(
  5. 'transaction:"/{organization_slug}/"'
  6. );
  7. // transaction.duration defaults to a number filter
  8. expect(ensureQuotedTextFilters('transaction.duration:100')).toEqual(
  9. 'transaction.duration:100'
  10. );
  11. });
  12. it('applies config overrides', () => {
  13. expect(
  14. ensureQuotedTextFilters('transaction:100', {
  15. numericKeys: new Set(['transaction']),
  16. })
  17. ).toEqual('transaction:100');
  18. expect(
  19. ensureQuotedTextFilters('transaction.duration:100', {
  20. numericKeys: new Set([]),
  21. })
  22. ).toEqual('transaction.duration:"100"');
  23. });
  24. });