import { describe, it, expect } from 'vitest'; import { mount } from '@vue/test-utils'; import { createVuetify } from 'vuetify'; import { createRouter, createMemoryHistory } from 'vue-router'; import AdminSystemView from '../../resources/js/views/admin/AdminSystemView.vue'; const mountView = async () => { const router = createRouter({ history: createMemoryHistory(), routes: [{ path: '/admin/system', component: AdminSystemView }], }); await router.push('/admin/system'); await router.isReady(); return mount(AdminSystemView, { global: { plugins: [createVuetify(), router] }, }); }; describe('AdminSystemView.vue', () => { it('монтируется и содержит заголовок «Система»', async () => { const wrapper = await mountView(); expect(wrapper.text()).toContain('Система'); }); it('показывает read-only warning', async () => { const wrapper = await mountView(); expect(wrapper.text()).toContain('Read-only'); }); it('перечисляет ключевые system_settings (rate-limit, retention, login_max_attempts)', async () => { const wrapper = await mountView(); const text = wrapper.text(); expect(text).toContain('webhook_rate_limit_rps'); expect(text).toContain('login_max_attempts'); expect(text).toContain('password_min_length'); expect(text).toContain('webhook_log_retention_days'); expect(text).toContain('maintenance_mode'); }); it('содержит type-chip для каждой строки (int/string/bool/json)', async () => { const wrapper = await mountView(); const text = wrapper.text(); expect(text).toContain('int'); expect(text).toContain('bool'); }); it('число строк settings = 7 (mock count)', async () => { const wrapper = await mountView(); const rows = wrapper.findAll('[data-testid="setting-row"]'); expect(rows.length).toBe(7); }); });