Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

770 B
Raw Blame
import { renderToString } from 'react-dom/server';
import { beforeEach, describe, expect, test } from 'vitest';
import { getCollector } from './collector';
import { ProfilerBoundary } from './profiler-boundary';

describe('<ProfilerBoundary>', () => {
  beforeEach(() => {
    getCollector()?.reset();
  });

  test('renders children', () => {
    const html = renderToString(
      <ProfilerBoundary name="test-renders">
        <span data-testid="child">hello</span>
      </ProfilerBoundary>,
    );
    expect(html).toContain('hello');
  });

  test('children prop is required in the TypeScript surface', () => {
    const node = (
      <ProfilerBoundary name="type-probe">
        <div />
      </ProfilerBoundary>
    );
    expect(node).toBeDefined();
  });
});