import { render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'

import TwitterEmbed from '@/components/TwitterEmbed'

describe ('TwitterEmbed', () => {
  it ('renders tweet and user links', () => {
    render (<TwitterEmbed userId="user_name" statusId="12345"/>)

    expect (screen.getByRole ('link', { name: '@user_name' })).toHaveAttribute (
        'href',
        'https://twitter.com/user_name?ref_src=twsrc%3Etfw',
    )
    expect (screen.getByRole ('link', { name: /\d/ })).toHaveAttribute (
        'href',
        'https://twitter.com/user_name/status/12345?ref_src=twsrc%5Etfw',
    )
  })
})
