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

45 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 { createRouter, createMemoryHistory } from 'vue-router';
import AdminBillingView from '../../resources/js/views/admin/AdminBillingView.vue';
const mountView = async () => {
const router = createRouter({
history: createMemoryHistory(),
routes: [{ path: '/admin/billing', component: AdminBillingView }],
});
await router.push('/admin/billing');
await router.isReady();
return mount(AdminBillingView, {
global: { plugins: [createVuetify(), router] },
});
};
describe('AdminBillingView.vue', () => {
it('монтируется и содержит заголовок «Биллинг»', async () => {
const wrapper = await mountView();
expect(wrapper.text()).toContain('Биллинг');
});
it('содержит 4 stats: MRR / Выручка / Просрочка / Возвраты', async () => {
const wrapper = await mountView();
const text = wrapper.text();
expect(text).toContain('MRR');
expect(text).toContain('Выручка за месяц');
expect(text).toContain('Просрочка');
expect(text).toContain('Возвраты за 30 дн');
});
it('содержит таблицу тенантов с tariff/balance/MRR/status', async () => {
const wrapper = await mountView();
const text = wrapper.text();
expect(text).toContain('Окна Москва');
expect(text).toContain('BigCorp');
expect(text).toContain('Команда');
expect(text).toContain('Активен');
expect(text).toContain('Просрочка');
expect(text).toContain('Заблокирован');
});
});