import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
import { QAWeekPicker } from './QAWeekPicker'
describe('QA week picker', () => {
it('offers a one-click current-week shortcut', () => {
const html = renderToStaticMarkup()
expect(html).toContain('>本周')
})
it('shows a year and numbered weeks with visible inclusive date ranges', () => {
const html = renderToStaticMarkup()
expect(html).toContain('aria-label="年份"')
expect(html).toContain('2026年')
expect(html).toContain('aria-label="周次"')
expect(html).toContain('value="40" selected=""')
expect(html).toContain('第40周(09-28 到 10-04)')
expect(html).toContain('第53周(2026-12-28 到 2027-01-03)')
expect(html).not.toContain('北京时间 · 周一至周日 · 本周截至当前')
})
it('preserves custom range mode and does not offer invalid week 53', () => {
const html = renderToStaticMarkup()
expect(html).toContain('value="" selected=""')
expect(html).toContain('自定义时间')
expect(html).not.toContain('第53周')
})
})