Files
portal/app/tests/Frontend/SalesProspectsView.spec.ts
T
Дмитрий 4b5afacfb7 feat(sales): экраны воронки — менеджер (свои) + начальник (все + фильтр)
Этап 1 Task 12–13. SalesProspectsView (менеджер, listProspects свои),
SalesProspectsBoardView (начальник, listSalesManagers фильтр, все карточки).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 16:44:29 +03:00

47 lines
1.5 KiB
TypeScript

import { mount, flushPromises } from '@vue/test-utils';
import { createVuetify } from 'vuetify';
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('../../resources/js/api/sales', () => ({
listProspects: vi.fn().mockResolvedValue({
prospects: [
{
id: 1,
sales_user_id: 1,
stage: 'new',
firm_name: 'ООО Демо',
city: 'Ростов',
phone: null,
site: null,
inn: null,
rating_label: 'горячая',
payload: {},
next_call_at: null,
reason: null,
registered_email: null,
notes: null,
},
],
by_stage: {},
stages: [],
}),
updateProspect: vi.fn().mockResolvedValue({ id: 1, stage: 'negotiation' }),
extractSalesErrorMessage: () => 'err',
}));
import SalesProspectsView from '../../resources/js/views/sales/SalesProspectsView.vue';
import { listProspects } from '../../resources/js/api/sales';
const vuetify = createVuetify();
describe('SalesProspectsView', () => {
beforeEach(() => vi.clearAllMocks());
it('загружает и показывает карточки менеджера', async () => {
const w = mount(SalesProspectsView, { global: { plugins: [vuetify] } });
await flushPromises();
expect(listProspects).toHaveBeenCalledWith(undefined);
expect(w.text()).toContain('ООО Демо');
});
});