import { it } from '@jest/globals';
import { newE2EPage } from '@stencil/core/testing';
import { stringifyProps } from './stringifyProps';
/**
 * Check that component is hydrated.
 */
const isHydrated = async (tagName, props) => {
  it('is hydrated', async () => {
    let expandedProps = '';
    if (props !== undefined) {
      expandedProps = stringifyProps(props);
    }
    // Render component
    const page = await newE2EPage({ failOnConsoleError: true });
    await page.setContent(`<${tagName} ${expandedProps}></${tagName}>`, {
      waitUntil: 'networkidle0',
    });
    const element = await page.find(tagName);
    expect(element).toHaveClass('hydrated');
  });
};
export default isHydrated;
