import { cleanup, render, screen } from '@testing-library/react' import { t } from 'i18next' import { afterEach, describe, expect, it } from 'vitest' import { AdaptiveSchedule } from '../adaptive-schedule' import { BenchmarkPanel } from '../detection-panel' afterEach(cleanup) describe('adaptive detection schedule', () => { it('shows one interval for channels with the same cadence', () => { render() expect( screen.getByText( t('Current interval: {{minutes}} minutes', { minutes: 60 }), { exact: false } ) ).toBeInTheDocument() }) it('shows a range for channels with different cadences', () => { render() expect( screen.getByText( t('Current intervals: {{min}}–{{max}} minutes', { min: 15, max: 60 }), { exact: false } ) ).toBeInTheDocument() }) it('uses the initial interval when no schedule has been recorded', () => { render() expect( screen.getByText( t('Current interval: {{minutes}} minutes', { minutes: 30 }), { exact: false } ) ).toBeInTheDocument() }) it('renders benchmark schedule data instead of the old fixed frequency', () => { render( ) expect( screen.getByText( t('Current intervals: {{min}}–{{max}} minutes', { min: 15, max: 30 }), { exact: false } ) ).toBeInTheDocument() expect( screen.queryByText(t('Every 30 minutes, one work per Astra channel.')) ).not.toBeInTheDocument() }) })