mirror of
https://github.com/kuhyx/testsAndMisc-archive.git
synced 2026-11-22 00:12:18 +01:00
The directory has existed on disk with 58 untracked files, four of them over the 250-line cap. An untracked file is invisible to every pre-commit hook, so those violations could not be fixed or gated while it stayed that way -- and its CI workflow was untracked too, so nothing ran against it. Landed with its already-written evidence artifact and a contract, since this crosses the 4-file threshold. Verified before staging: 58 plain text source/config files, no binaries, no node_modules, no build output. npm run check passes -- typecheck, eslint --max-warnings 0, and 220 tests at 100% statements/branches/functions/lines. Splitting its four oversized files is deliberately a separate commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import { describe, expect, it } from 'vitest'
|
|
import type { Card as CardModel } from '../engine/types'
|
|
import { Card, CardBack } from './Card'
|
|
|
|
describe('Card', () => {
|
|
it('renders a black-suit card without the red modifier', () => {
|
|
const card: CardModel = { rank: 14, suit: 'spades' }
|
|
render(<Card card={card} />)
|
|
const el = screen.getByLabelText('A of spades')
|
|
expect(el.className).not.toContain('card--red')
|
|
expect(el.textContent).toBe('A♠')
|
|
})
|
|
|
|
it('renders a red-suit card with the red modifier', () => {
|
|
const card: CardModel = { rank: 10, suit: 'hearts' }
|
|
render(<Card card={card} />)
|
|
const el = screen.getByLabelText('10 of hearts')
|
|
expect(el.className).toContain('card--red')
|
|
expect(el.textContent).toBe('10♥')
|
|
})
|
|
|
|
it('renders every rank label correctly', () => {
|
|
const ranks: { rank: CardModel['rank']; label: string }[] = [
|
|
{ rank: 2, label: '2' },
|
|
{ rank: 9, label: '9' },
|
|
{ rank: 10, label: '10' },
|
|
{ rank: 11, label: 'J' },
|
|
{ rank: 12, label: 'Q' },
|
|
{ rank: 13, label: 'K' },
|
|
{ rank: 14, label: 'A' },
|
|
]
|
|
for (const { rank, label } of ranks) {
|
|
const { unmount } = render(<Card card={{ rank, suit: 'clubs' }} />)
|
|
expect(screen.getByText(`${label}♣`)).toBeInTheDocument()
|
|
unmount()
|
|
}
|
|
})
|
|
})
|
|
|
|
describe('CardBack', () => {
|
|
it('renders a face-down placeholder', () => {
|
|
render(<CardBack />)
|
|
expect(screen.getByLabelText('face-down card')).toBeInTheDocument()
|
|
})
|
|
})
|