245b76ec43
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>
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import StatusPill from '../../resources/js/components/ui/StatusPill.vue';
|
|
|
|
describe('StatusPill', () => {
|
|
it('renders label text', () => {
|
|
const w = mount(StatusPill, { props: { slug: 'new', label: 'Новый' } });
|
|
expect(w.text()).toContain('Новый');
|
|
});
|
|
|
|
it('falls back to slug when label not provided', () => {
|
|
const w = mount(StatusPill, { props: { slug: 'in_progress' } });
|
|
expect(w.text()).toContain('in_progress');
|
|
});
|
|
|
|
it.each(['new', 'in_progress', 'won', 'archived', 'cancelled'])('applies correct background for %s', (slug) => {
|
|
const w = mount(StatusPill, { props: { slug } });
|
|
const style = w.attributes('style') ?? '';
|
|
expect(style).toContain('background');
|
|
expect(style).toContain('color');
|
|
});
|
|
|
|
it('cancelled slug applies line-through', () => {
|
|
const w = mount(StatusPill, { props: { slug: 'cancelled' } });
|
|
expect(w.attributes('style') ?? '').toContain('line-through');
|
|
});
|
|
|
|
it('won slug applies font-weight: 600', () => {
|
|
const w = mount(StatusPill, { props: { slug: 'won' } });
|
|
expect(w.attributes('style') ?? '').toMatch(/font-weight:\s*600/);
|
|
});
|
|
});
|