3bbd7787d8
- Remove archived_at from Project interface; rename store.archive → store.del
- BulkActionsBar: archive button → delete (testid, icon, confirm text)
- ProjectCard: archive menu item → delete (emit + icon)
- ProjectDetailsDrawer: confirm text + store.del call
- ProjectsView: @delete binding, remove 'Архивные' status filter entry
- vuetify.ts: add mdi-delete → Trash2 mapping
- All specs/stories updated: archived_at removed, archive → del renamed
- New test: del() calls DELETE /api/projects/{id}
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import { createVuetify } from 'vuetify';
|
|
import ProjectCard from '../../resources/js/components/projects/ProjectCard.vue';
|
|
|
|
const vuetify = createVuetify();
|
|
const baseProject = {
|
|
id: 1,
|
|
name: 'Окна СПб',
|
|
signal_type: 'site' as const,
|
|
signal_identifier: 'okna.ru',
|
|
daily_limit_target: 50,
|
|
delivered_today: 32,
|
|
is_active: true,
|
|
sync_status: 'ok' as const,
|
|
};
|
|
|
|
describe('ProjectCard', () => {
|
|
it('renders project name + signal_identifier', () => {
|
|
const wrapper = mount(ProjectCard, {
|
|
global: { plugins: [vuetify] },
|
|
props: { project: baseProject, selected: false },
|
|
});
|
|
expect(wrapper.text()).toContain('Окна СПб');
|
|
expect(wrapper.text()).toContain('okna.ru');
|
|
});
|
|
|
|
it('shows progress percentage 32/50', () => {
|
|
const wrapper = mount(ProjectCard, {
|
|
global: { plugins: [vuetify] },
|
|
props: { project: baseProject, selected: false },
|
|
});
|
|
expect(wrapper.text()).toMatch(/32.*50/);
|
|
});
|
|
|
|
it('emits select event on checkbox change', async () => {
|
|
const wrapper = mount(ProjectCard, {
|
|
global: { plugins: [vuetify] },
|
|
props: { project: baseProject, selected: false },
|
|
});
|
|
await wrapper.find('[data-testid="card-select"] input').trigger('change');
|
|
expect(wrapper.emitted('toggle-select')).toBeTruthy();
|
|
});
|
|
|
|
it('shows "На паузе" when is_active=false', () => {
|
|
const wrapper = mount(ProjectCard, {
|
|
global: { plugins: [vuetify] },
|
|
props: { project: { ...baseProject, is_active: false }, selected: false },
|
|
});
|
|
expect(wrapper.text()).toContain('На паузе');
|
|
});
|
|
});
|