import { mount } from '@vue/test-utils'; import { describe, expect, it } from 'vitest'; import BalanceCard from '../../resources/js/components/billing/BalanceCard.vue'; import { createVuetify } from 'vuetify'; const vuetify = createVuetify(); const baseProps = { walletRub: 5000, affordableLeads: 46, currentTierPriceRub: '120.00', tariffName: 'Стартовый', tariffFeatures: ['UTM', 'Webhook'], }; describe('BalanceCard (Billing v2 Spec A)', () => { it('shows wallet ₽ formatted with thousands separator', () => { const w = mount(BalanceCard, { props: baseProps, global: { plugins: [vuetify] } }); // Intl.NumberFormat('ru-RU') uses U+00A0 (non-breaking space) — match any whitespace expect(w.text()).toMatch(/5\s000/); }); it('shows «≈ N лидов» using affordableLeads', () => { const w = mount(BalanceCard, { props: baseProps, global: { plugins: [vuetify] } }); expect(w.text()).toContain('≈ 46'); expect(w.text()).toContain('лидов'); }); it('does NOT contain «(ГЦК)»', () => { const w = mount(BalanceCard, { props: baseProps, global: { plugins: [vuetify] } }); expect(w.text()).not.toContain('ГЦК'); }); it('does NOT contain «округление вниз ₽→лиды»', () => { const w = mount(BalanceCard, { props: baseProps, global: { plugins: [vuetify] } }); expect(w.text()).not.toContain('округление вниз'); }); it('tariff card shows name + features but NO «₽/мес»', () => { const w = mount(BalanceCard, { props: baseProps, global: { plugins: [vuetify] } }); expect(w.text()).toContain('Стартовый'); expect(w.text()).not.toContain('₽/мес'); }); it('renders «сейчас по X ₽/лид» subline', () => { const w = mount(BalanceCard, { props: baseProps, global: { plugins: [vuetify] } }); expect(w.text()).toContain('120.00 ₽/лид'); }); });