Files
portal/app/tests/Frontend/DashboardView.spec.ts
T

48 lines
1.8 KiB
TypeScript
Raw Normal View History

import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import { createVuetify } from 'vuetify';
import DashboardView from '../../resources/js/views/DashboardView.vue';
describe('DashboardView.vue', () => {
const factory = () =>
mount(DashboardView, {
global: { plugins: [createVuetify()] },
});
it('монтируется и содержит приветствие', () => {
const wrapper = factory();
expect(wrapper.text()).toContain('Доброе утро');
});
it('содержит range-toggle с 4 опциями', () => {
const wrapper = factory();
const text = wrapper.text();
expect(text).toContain('Сегодня');
expect(text).toContain('7 дней');
expect(text).toContain('30 дней');
expect(text).toContain('Период');
});
it('содержит 3 KPI-cards (получено лидов / конверсия / активные проекты)', () => {
const wrapper = factory();
const text = wrapper.text();
expect(text).toContain('Получено лидов');
expect(text).toContain('Конверсия в оплату');
expect(text).toContain('Активные проекты');
});
it('содержит balance-card с suммой и runway', () => {
const wrapper = factory();
const text = wrapper.text();
expect(text).toContain('Баланс');
expect(text).toContain('14 250');
expect(text).toContain('LIVE');
expect(text).toContain('хватит на');
});
it('runway-bar содержит 7 сегментов (по числу runwayMax)', () => {
const wrapper = factory();
expect(wrapper.findAll('.runway-fill')).toHaveLength(7);
});
});