github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/components/Heatmap/HeatmapTooltip.spec.tsx (about)

     1  import React, { RefObject } from 'react';
     2  import { render, screen } from '@testing-library/react';
     3  
     4  import HeatmapTooltip from './HeatmapTooltip';
     5  import { heatmapMockData } from '../../services/exemplarsTestData';
     6  
     7  const canvasEl = document.createElement('canvas');
     8  const canvasRef = { current: canvasEl } as RefObject<HTMLCanvasElement>;
     9  
    10  describe('Component: HeatmapTooltip', () => {
    11    const renderTooltip = () => {
    12      render(
    13        <HeatmapTooltip
    14          dataSourceElRef={canvasRef}
    15          heatmapW={400}
    16          heatmap={heatmapMockData}
    17          timezone="browser"
    18          sampleRate={100}
    19        />
    20      );
    21    };
    22  
    23    it('should render initial tooltip (not active)', () => {
    24      renderTooltip();
    25  
    26      expect(screen.getByTestId('heatmap-tooltip')).toBeInTheDocument();
    27    });
    28  });