Files
portal/app/tests/Frontend/vuetifyTheme.spec.ts
T
Дмитрий 245b76ec43 test(frontend): fix 17 ESLint errors + TwoFactorView router stub
ESLint emitted 17 errors in tests/Frontend/* (production code clean):
- 13× @typescript-eslint/no-explicit-any in axios mock casts
  (BulkActionsBar, ProjectsView, projectsStore specs)
- 3× vitest/no-disabled-tests rule-not-found
  (eslint-plugin-vitest not registered; inline-disable comments stale)
- 1× @typescript-eslint/no-unused-vars on imported beforeEach

Plus Phase 5 audit finding: TwoFactorView.spec.ts test router was
missing /recovery-use stub → Vue Router warn on every TwoFactorView mount.

Changes:
- BulkActionsBar.spec.ts, ProjectsView.spec.ts, projectsStore.spec.ts:
  replace `as any` with `as unknown as ReturnType<typeof vi.fn>` on
  axios method mocks; one case used `as unknown as { regionsOpen: bool }`
  for vm shape.
- NewProjectDialog.spec.ts, ProjectsView.spec.ts: remove stale
  `// eslint-disable-next-line vitest/no-disabled-tests` comments
  (it.skip() lines kept).
- ProjectsView.toolbar.spec.ts: drop unused `beforeEach` from import.
- TwoFactorView.spec.ts: add `/recovery-use` route stub.

Verification:
- npx eslint --max-warnings=0 → exit 0 (was 17 errors).
- npx vitest run on affected specs → 24/27 passed + 3 skipped (was same).
- TwoFactorView spec → 3/3 passed, no Vue Router warn.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 20:23:51 +03:00

48 lines
1.7 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { vuetify } from '../../resources/js/plugins/vuetify';
describe('Vuetify theme — liderraForest', () => {
const theme = vuetify.theme.themes.value.liderraForest;
it.each([
['primary', '#0F6E56'],
['secondary', '#012019'],
['background', '#F6F3EC'],
['surface', '#FFFFFF'],
['success', '#2E8B57'],
['warning', '#D9A441'],
['error', '#B83A3A'],
['info', '#3F7C95'],
['liderra-plum', '#7A5BA3'],
['liderra-salmon', '#CC6E50'],
['liderra-teal-deep', '#0A5A47'],
['liderra-muted', '#6B6356'],
])('color %s = %s', (key, value) => {
expect(theme.colors[key]?.toUpperCase()).toBe(value.toUpperCase());
});
});
describe('Vuetify global defaults', () => {
it('VBtn defaults to flat variant', () => {
expect(
(vuetify as unknown as { defaults: { value: Record<string, Record<string, unknown>> } }).defaults.value.VBtn
?.variant,
).toBe('flat');
});
it('VCard defaults to rounded lg + variant flat + border', () => {
const card = (vuetify as unknown as { defaults: { value: Record<string, Record<string, unknown>> } }).defaults
.value.VCard;
expect(card?.rounded).toBe('lg');
expect(card?.variant).toBe('flat');
expect(card?.border).toBe(true);
});
it('VTextField defaults to outlined + density comfortable', () => {
const tf = (vuetify as unknown as { defaults: { value: Record<string, Record<string, unknown>> } }).defaults
.value.VTextField;
expect(tf?.variant).toBe('outlined');
expect(tf?.density).toBe('comfortable');
});
});