// import { expect, test } from '@jest/globals';
import { render, screen } from '@testing-library/react';
import { composeStories } from '@storybook/react';
import '@testing-library/jest-dom';

import * as DemoStories from './demo.stories';

const { Base{{COMPONENT_CLASS_NAME}} } = composeStories(DemoStories);

test('renders {{COMPONENT_CLASS_NAME}}', async () => {
  render(<Base{{COMPONENT_CLASS_NAME}} />);
  expect(await screen.findByText('Currency Sample')).toBeVisible();
  expect(await screen.findByText('Currency Helper Text')).toBeVisible();

  const currencyElement = screen.getByRole('textbox');
  // for some odd reason, checking the full string of "USD 0.00" doesn't pass
  // expect(currencyElement).toHaveValue('USD 0.00');
  const myTextAreaVal = (screen.getByRole('textbox') as HTMLInputElement).value;
  expect(myTextAreaVal).toContain('USD');
  expect(myTextAreaVal).toContain('0.00');

  expect(currencyElement).toHaveAttribute('placeholder', 'Currency Placeholder');
});
