505b8ed059
Кнопка «🔄 Собрать источники ещё раз» вместо мёртвой «✓ Источники собраны». Окно предупреждает, что повтор платный (даже если нового нет). Честный итог после сбора (N новых / M ранее удалённых). Блок «ранее удалённые — вернуть?» с кнопкой «Вернуть» (box archived→proposal). - RunDto.result + collectResultMessage (чистый хелпер) + тесты - store.restoreSource + тест - компонент RefoundDeletedSources + тест - FieldCompetitorScreen: кнопка-повтор, честный итог, блок «вернуть», текст окна Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
1.4 KiB
TypeScript
28 lines
1.4 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import RefoundDeletedSources from '../../resources/js/views/autopodbor/screens/RefoundDeletedSources.vue';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const src = (id: number, identifier: string): any => ({ id, identifier, signal_type: 'site', box: 'archived' });
|
|
|
|
describe('RefoundDeletedSources — блок «ранее удалённые, вернуть?»', () => {
|
|
it('показывает ранее удалённые источники и кнопки «Вернуть»', () => {
|
|
const w = mount(RefoundDeletedSources, { props: { sources: [src(7, 'staroe.ru'), src(9, '79001112233')] } });
|
|
expect(w.text()).toContain('staroe.ru');
|
|
expect(w.text()).toContain('79001112233');
|
|
expect(w.text().toLowerCase()).toContain('ранее удал');
|
|
expect(w.findAll('button').length).toBe(2);
|
|
});
|
|
|
|
it('клик «Вернуть» шлёт событие restore с id источника', async () => {
|
|
const w = mount(RefoundDeletedSources, { props: { sources: [src(7, 'staroe.ru')] } });
|
|
await w.find('button').trigger('click');
|
|
expect(w.emitted('restore')?.[0]).toEqual([7]);
|
|
});
|
|
|
|
it('пусто → блок не рисуется', () => {
|
|
const w = mount(RefoundDeletedSources, { props: { sources: [] } });
|
|
expect(w.text().trim()).toBe('');
|
|
});
|
|
});
|