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>
35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import { createVuetify } from 'vuetify';
|
|
import DaysBulkDialog from '../../resources/js/components/projects/DaysBulkDialog.vue';
|
|
|
|
const mountDialog = (count = 5) =>
|
|
mount(DaysBulkDialog, {
|
|
props: { modelValue: true, count },
|
|
global: { plugins: [createVuetify()], stubs: { VDialog: { template: '<div><slot /></div>' } } },
|
|
});
|
|
|
|
describe('DaysBulkDialog', () => {
|
|
it('renders 7 weekday buttons for Add and Remove', () => {
|
|
const wrapper = mountDialog();
|
|
expect(wrapper.findAll('[data-testid^="day-add-"]').length).toBe(7);
|
|
expect(wrapper.findAll('[data-testid^="day-remove-"]').length).toBe(7);
|
|
});
|
|
|
|
it('emits apply with bitmasks (add Tue+Thu, remove Sat+Sun)', async () => {
|
|
const wrapper = mountDialog();
|
|
await wrapper.find('[data-testid="day-add-2"]').trigger('click'); // Вт
|
|
await wrapper.find('[data-testid="day-add-8"]').trigger('click'); // Чт
|
|
await wrapper.find('[data-testid="day-remove-32"]').trigger('click'); // Сб
|
|
await wrapper.find('[data-testid="day-remove-64"]').trigger('click'); // Вс
|
|
await wrapper.find('[data-testid="apply"]').trigger('click');
|
|
|
|
expect(wrapper.emitted('apply')?.[0]).toEqual([{ add: 10, remove: 96 }]);
|
|
});
|
|
|
|
it('apply disabled when both masks are 0', () => {
|
|
const wrapper = mountDialog();
|
|
expect(wrapper.find('[data-testid="apply"]').attributes('disabled')).toBeDefined();
|
|
});
|
|
});
|