012053a783
Audit A7: the «Оферта» / «Политика» links in the AuthLayout footer were raw <a href> pointing at unrouted paths -> 404 via the SPA catch-all. Adds a single DRY LegalDocView served by /legal/:doc(offer|privacy), rendering an honest «document being finalized» stub (real legal text needs юр. редактура — реестр K3 / blocker Б-1). Footer links upgraded to <RouterLink> for SPA navigation. Also refreshes two stale auth-layout doc-comments left by the /recovery removal (review M1). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import { createVuetify } from 'vuetify';
|
|
import { createRouter, createMemoryHistory, type Router } from 'vue-router';
|
|
|
|
import LegalDocView from '../../resources/js/views/legal/LegalDocView.vue';
|
|
|
|
const vuetify = createVuetify();
|
|
|
|
const buildRouter = (): Router =>
|
|
createRouter({
|
|
history: createMemoryHistory(),
|
|
routes: [
|
|
{ path: '/legal/:doc(offer|privacy)', name: 'legal', component: LegalDocView },
|
|
{ path: '/login', name: 'login', component: { template: '<div>login</div>' } },
|
|
],
|
|
});
|
|
|
|
const mountAt = async (path: string) => {
|
|
const router = buildRouter();
|
|
await router.push(path);
|
|
await router.isReady();
|
|
return mount(LegalDocView, { global: { plugins: [vuetify, router] } });
|
|
};
|
|
|
|
describe('LegalDocView.vue', () => {
|
|
it('рендерит «Договор-оферта» на /legal/offer', async () => {
|
|
const wrapper = await mountAt('/legal/offer');
|
|
expect(wrapper.text()).toContain('Договор-оферта');
|
|
});
|
|
|
|
it('рендерит «Политика конфиденциальности» на /legal/privacy', async () => {
|
|
const wrapper = await mountAt('/legal/privacy');
|
|
expect(wrapper.text()).toContain('Политика конфиденциальности');
|
|
});
|
|
|
|
it('показывает честную заглушку «документ готовится», а не фейк-текст', async () => {
|
|
const wrapper = await mountAt('/legal/offer');
|
|
const notice = wrapper.find('[data-testid="legal-stub-notice"]');
|
|
expect(notice.exists()).toBe(true);
|
|
expect(notice.text()).toContain('готовится');
|
|
});
|
|
|
|
it('содержит ссылку возврата ко входу', async () => {
|
|
const wrapper = await mountAt('/legal/privacy');
|
|
const back = wrapper.find('a.legal-back');
|
|
expect(back.exists()).toBe(true);
|
|
expect(back.attributes('href')).toBe('/login');
|
|
});
|
|
});
|