import { describe, it, expect } from 'vitest'; import { mount } from '@vue/test-utils'; import CollectingIndicator from '../../resources/js/views/autopodbor/screens/CollectingIndicator.vue'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const run = (over: any): any => ({ status: 'running', queue_position: null, progress: null, ...over }); describe('CollectingIndicator — бегущий индикатор сбора', () => { it('в очереди — «вы в очереди №N» + крутящийся кружок', () => { const w = mount(CollectingIndicator, { props: { run: run({ status: 'queued', queue_position: 3 }) } }); expect(w.text()).toContain('№3'); expect(w.text().toLowerCase()).toContain('очеред'); expect(w.find('.ld-collecting__spin').exists()).toBe(true); }); it('идёт работа — показывает этап N из M и подпись', () => { const w = mount(CollectingIndicator, { props: { run: run({ progress: { stage: 2, total: 4, label: 'Ищем фирмы в справочниках' } }) }, }); expect(w.text()).toContain('2'); expect(w.text()).toContain('4'); expect(w.text()).toContain('Ищем фирмы в справочниках'); }); it('идёт, но этап ещё не пришёл — общий текст «идёт сбор» + кружок', () => { const w = mount(CollectingIndicator, { props: { run: run({}) } }); expect(w.text().toLowerCase()).toContain('идёт'); expect(w.find('.ld-collecting__spin').exists()).toBe(true); }); it('run=null — общий текст, не падает', () => { const w = mount(CollectingIndicator, { props: { run: null } }); expect(w.find('.ld-collecting__spin').exists()).toBe(true); }); });