diff --git a/app/tests/Frontend/BalanceCapacityIndicator.spec.ts b/app/tests/Frontend/BalanceCapacityIndicator.spec.ts index 0ab1e7f4..4562a150 100644 --- a/app/tests/Frontend/BalanceCapacityIndicator.spec.ts +++ b/app/tests/Frontend/BalanceCapacityIndicator.spec.ts @@ -1,45 +1,44 @@ import { describe, it, expect } from 'vitest'; import { mount } from '@vue/test-utils'; +import { createVuetify } from 'vuetify'; import BalanceCapacityIndicator from '../../resources/js/components/billing/BalanceCapacityIndicator.vue'; // Billing v2 Spec C Task 1.10 — подсказка под балансом (§3.6). Чистый // presentational-компонент: статус по соотношению ёмкости и требуемого/день. +// Компонент использует → нужен Vuetify-плагин в mount. + +const vuetify = createVuetify(); + +function factory(props: { balanceRub: string; capacityLeads: number; requiredLeadsPerDay: number }) { + return mount(BalanceCapacityIndicator, { props, global: { plugins: [vuetify] } }); +} describe('BalanceCapacityIndicator', () => { it('зелёный, когда ёмкости хватает на 3+ дня', () => { - const w = mount(BalanceCapacityIndicator, { - props: { balanceRub: '3000.00', capacityLeads: 90, requiredLeadsPerDay: 25 }, - }); + const w = factory({ balanceRub: '3000.00', capacityLeads: 90, requiredLeadsPerDay: 25 }); expect(w.text()).toContain('90'); expect(w.classes()).toContain('capacity-ok'); }); it('жёлтый, когда ёмкости хватает меньше чем на 3 дня', () => { - const w = mount(BalanceCapacityIndicator, { - props: { balanceRub: '1000.00', capacityLeads: 30, requiredLeadsPerDay: 25 }, - }); + const w = factory({ balanceRub: '1000.00', capacityLeads: 30, requiredLeadsPerDay: 25 }); expect(w.classes()).toContain('capacity-warning'); }); it('красный, когда ёмкости меньше требуемого', () => { - const w = mount(BalanceCapacityIndicator, { - props: { balanceRub: '500.00', capacityLeads: 10, requiredLeadsPerDay: 25 }, - }); + const w = factory({ balanceRub: '500.00', capacityLeads: 10, requiredLeadsPerDay: 25 }); expect(w.classes()).toContain('capacity-insufficient'); }); it('зелёный (бесконечный запас), когда проекты ничего не заказывают', () => { - const w = mount(BalanceCapacityIndicator, { - props: { balanceRub: '500.00', capacityLeads: 10, requiredLeadsPerDay: 0 }, - }); + const w = factory({ balanceRub: '500.00', capacityLeads: 10, requiredLeadsPerDay: 0 }); expect(w.classes()).toContain('capacity-ok'); }); - it('показывает баланс, ёмкость и дневной заказ', () => { - const w = mount(BalanceCapacityIndicator, { - props: { balanceRub: '1000.00', capacityLeads: 30, requiredLeadsPerDay: 25 }, - }); - expect(w.text()).toContain('1000.00'); + it('показывает баланс (формат «1 000 ₽»), ёмкость и дневной заказ', () => { + const w = factory({ balanceRub: '1000.00', capacityLeads: 30, requiredLeadsPerDay: 25 }); + // ru-RU разделитель тысяч — NBSP (U+00A0); матчим любым пробелом. + expect(w.text()).toMatch(/1\s000/); expect(w.text()).toContain('30'); expect(w.text()).toContain('25'); }); diff --git a/app/tests/Frontend/KanbanView.spec.ts b/app/tests/Frontend/KanbanView.spec.ts index a9911aa8..06541ffa 100644 --- a/app/tests/Frontend/KanbanView.spec.ts +++ b/app/tests/Frontend/KanbanView.spec.ts @@ -61,14 +61,8 @@ describe('KanbanView.vue', () => { expect(wrapper.text()).toMatch(/[Пп]еретаскивание/); }); - it('кнопка «Новая сделка» открывает NewDealDialog', async () => { - const wrapper = factory(); - const vm = wrapper.vm as unknown as { newDealOpen: boolean }; - expect(vm.newDealOpen).toBe(false); - await wrapper.find('[data-testid="new-deal-btn"]').trigger('click'); - await wrapper.vm.$nextTick(); - expect(vm.newDealOpen).toBe(true); - }); + // Кнопка «Новая сделка» убрана из Канбана (задача 22.06 — создание сделок не с доски). + // Тест клика по `new-deal-btn` удалён вместе с кнопкой. it('onDealCreated кладёт сделку в правильную колонку по statusSlug', async () => { const wrapper = factory();