789e7dcdb6
UX-request 18.05.2026 (пп.4/6/7): - удалена секция «Менеджер»/«Не назначен» (менеджеров в системе пока нет) - добавлен параметр «Тип» (Сайт/Звонок/СМС) — project.signal_type - добавлен параметр «Источник» (read-only): - site/call → project.signal_identifier (домен или телефон) - sms → sms_senders[0] + ' (KEYWORD)' если sms_keyword не пустой - удалён hardcoded «Я.Директ → landing-1» Backend: DealController index + show + update payload расширены 4 полями project_signal_type/identifier/sms_keyword/sms_senders + eager-load project relation расширен. Редактирование источника — только в карточке проекта (Task 5 плана). Larastan baseline bumped (DealShowTest: tenant 13→20, getJson 7→10 для 3 новых тестов). Pest 51/51 на Deal-endpoints. Vitest 108 files / 875 passed / 3 skipped (5 новых тестов DealDetailBody). Build 2.30s. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
87 lines
3.3 KiB
TypeScript
87 lines
3.3 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
||
import { mount } from '@vue/test-utils';
|
||
import { createVuetify } from 'vuetify';
|
||
import { setActivePinia, createPinia } from 'pinia';
|
||
import DealDetailBody from '../../resources/js/components/deals/DealDetailBody.vue';
|
||
import type { MockDeal } from '../../resources/js/composables/mockDeals';
|
||
|
||
const vuetify = createVuetify();
|
||
|
||
function makeDeal(overrides: Partial<MockDeal> = {}): MockDeal {
|
||
return {
|
||
id: 1, name: '+79991234567', phone: '+79991234567', statusSlug: 'new',
|
||
project: 'p', manager: { initials: 'AD', name: 'Admin' }, cost: 0,
|
||
receivedMinutesAgo: 1,
|
||
projectSignalType: 'site', projectSignalIdentifier: 'krk-finance.ru',
|
||
projectSmsKeyword: null, projectSmsSenders: null,
|
||
...overrides,
|
||
};
|
||
}
|
||
|
||
describe('DealDetailBody — Тип и Источник (18.05.2026 ux)', () => {
|
||
it('site: показывает Тип «Сайт» и Источник = signal_identifier', () => {
|
||
setActivePinia(createPinia());
|
||
const w = mount(DealDetailBody, {
|
||
props: { deal: makeDeal() },
|
||
global: { plugins: [vuetify] },
|
||
});
|
||
expect(w.text()).toContain('Сайт');
|
||
expect(w.text()).toContain('krk-finance.ru');
|
||
});
|
||
|
||
it('call: Тип «Звонок» и Источник = телефонный номер', () => {
|
||
setActivePinia(createPinia());
|
||
const w = mount(DealDetailBody, {
|
||
props: { deal: makeDeal({
|
||
projectSignalType: 'call',
|
||
projectSignalIdentifier: '79992223344',
|
||
}) },
|
||
global: { plugins: [vuetify] },
|
||
});
|
||
expect(w.text()).toContain('Звонок');
|
||
expect(w.text()).toContain('79992223344');
|
||
});
|
||
|
||
it('sms с keyword: Источник = «sender (KEYWORD)»', () => {
|
||
setActivePinia(createPinia());
|
||
const w = mount(DealDetailBody, {
|
||
props: { deal: makeDeal({
|
||
projectSignalType: 'sms',
|
||
projectSignalIdentifier: null,
|
||
projectSmsSenders: ['MTS', 'BEELINE'],
|
||
projectSmsKeyword: 'КРЕДИТ',
|
||
}) },
|
||
global: { plugins: [vuetify] },
|
||
});
|
||
expect(w.text()).toContain('СМС');
|
||
expect(w.text()).toContain('MTS (КРЕДИТ)');
|
||
});
|
||
|
||
it('sms без keyword: Источник = только sender', () => {
|
||
setActivePinia(createPinia());
|
||
const w = mount(DealDetailBody, {
|
||
props: { deal: makeDeal({
|
||
projectSignalType: 'sms',
|
||
projectSignalIdentifier: null,
|
||
projectSmsSenders: ['MTS'],
|
||
projectSmsKeyword: null,
|
||
}) },
|
||
global: { plugins: [vuetify] },
|
||
});
|
||
expect(w.text()).toContain('СМС');
|
||
expect(w.text()).toContain('MTS');
|
||
// Никаких пустых скобок
|
||
expect(w.text()).not.toMatch(/\(\s*\)/);
|
||
});
|
||
|
||
it('не отображает «Менеджер»', () => {
|
||
setActivePinia(createPinia());
|
||
const w = mount(DealDetailBody, {
|
||
props: { deal: makeDeal() },
|
||
global: { plugins: [vuetify] },
|
||
});
|
||
expect(w.text()).not.toContain('Менеджер');
|
||
expect(w.text()).not.toContain('Не назначен');
|
||
});
|
||
});
|