<commit_before>import React from 'react'
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
import Alert from '../Alert'

test('Alert is showing', () => {
  render(<Alert type="success" message="hello" />)
  const alert = screen.getByRole('alert')
  expect(alert).toBeTruthy()
})

test('Alert is not showing', () => {
  render(<Alert message="hello" />)
  const alert = screen.queryByRole('alert')
  expect(alert).toBeFalsy()
})

test('Invoke callback through click', () => {
  const onClickCallback = jest.fn()
  render(
    <Alert
      type="success"
      message="hello"
      onClick={onClickCallback}
    />
  )
  const clickButton = document.querySelector('.alert__close')
  fireEvent.click(clickButton)
  expect(onClickCallback).toHaveBeenCalled()
})

test('Invoke callback through timer', async () => {
  const onClickCallback = jest.fn()
  render(
    <Alert<commit_msg>static/tests: fix frontend tests<commit_after>import React from 'react'
import { render, fireEvent, waitFor } from '@testing-library/react'
import Alert from '../Alert'

test('Alert is showing', () => {
  render(<Alert type="success" message="hello" />)
  const alert = document.querySelector('#alert')
  expect(alert).toBeTruthy()
})

test('Alert is not showing', () => {
  render(<Alert type="" message="" />)
  const alert = document.querySelector('#alert')
  expect(alert).toBeTruthy()
})

test('Invoke callback through click', () => {
  const onClickCallback = jest.fn()
  render(
    <Alert
      type="success"
      message="hello"
      aria-atomic="true"
      onClick={onClickCallback}
    />
  )
  const clickButton = document.querySelector('.alert__close')
  fireEvent.click(clickButton)
  expect(onClickCallback).toHaveBeenCalled()
})

test('Invoke callback through timer', async () => {
  const onClickCallback = jest.fn()
  render(
    <Alert
{'fraction_non_alphanumeric': 0.157725321888412, 'fraction_numerical': 0.0, 'mean_word_length': 4.3746397694524495, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2222899', 'n_tokens_mistral': 554, 'n_tokens_neox': 555, 'n_words': 127}