columnEditCollection.spec.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import type {Organization} from 'sentry/types/organization';
  4. import ColumnEditCollection from 'sentry/views/discover/table/columnEditCollection';
  5. describe('ColumnEditCollection', () => {
  6. let organization: Organization;
  7. beforeEach(() => {
  8. organization = OrganizationFixture();
  9. });
  10. it('does not render the Add an Equation button when equations are not supported', () => {
  11. render(
  12. <ColumnEditCollection
  13. columns={[]}
  14. fieldOptions={{}}
  15. onChange={jest.fn()}
  16. organization={organization}
  17. supportsEquations={false}
  18. />
  19. );
  20. expect(screen.queryByText('Add an Equation')).not.toBeInTheDocument();
  21. });
  22. it('renders the Add an Equation button when equations are supported', () => {
  23. render(
  24. <ColumnEditCollection
  25. columns={[]}
  26. fieldOptions={{}}
  27. onChange={jest.fn()}
  28. organization={organization}
  29. supportsEquations
  30. />
  31. );
  32. expect(screen.getByText('Add an Equation')).toBeInTheDocument();
  33. });
  34. });