// @vitest-environment jsdom
/** What the PartCard page claims, pinned: the header opens what it is part of, the blocks draw, and the states say so. */
import { cleanup, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it } from 'vitest'
import { PartCard } from './PartCard'
afterEach(cleanup)
describe('PartCard', () => {
it('opens what it is part of from its header, and draws the blocks it is given', () => {
render(
The blocks
,
)
expect(screen.getByRole('link', { name: /ABC-2.*Item one/ }).getAttribute('href')).toBe('#part')
expect(screen.getByText('The blocks')).toBeTruthy()
})
it('says a part is not available in words', () => {
render()
expect(screen.getByText('A part of this item — not available.')).toBeTruthy()
})
it('while it loads, is busy and shows nothing of it', () => {
const { container } = render()
expect(container.querySelector('[aria-busy="true"]')).not.toBeNull()
expect(screen.queryByRole('link')).toBeNull()
})
})