feat: definition of done per project

A project can ask that tickets reach a DONE status only with their
checklist ticked (settings.checklistBeforeDone, off by default; absent
when saving means unchanged). Members get a 422 telling how many steps are
left; owners and admins may still close it. Settings has the switch and
the ticket's checklist says when the project asks for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 14:39:24 +02:00
parent 5b0396bc10
commit e598f76e1c
25 changed files with 285 additions and 4 deletions

View File

@@ -353,4 +353,54 @@ describe('Project settings', () => {
});
});
});
it('holds a ticket with an unticked checklist out of DONE, if asked', () => {
const project = newProject();
const issue = new IssueFactory().create(
{
projectId: project.id,
projectKey: 'WEB',
number: 1,
title: 'Pago',
type: 'TASK',
reporterId: 'dev',
},
project.workflow,
);
issue.addChecklistItem('dev', 'a', 'Probar en Safari');
issue.addChecklistItem('dev', 'b', 'Probar en Chrome');
for (const to of [
'TODO',
'IN_PROGRESS',
'IN_REVIEW',
'READY_FOR_QA',
'IN_QA',
])
issue.changeStatus('dev', to, null, project.workflow);
// Off by default: nothing changes for projects that do not ask.
const done = () =>
issue.changeStatus('dev', 'DONE', null, project.workflow);
expect(project.workflow.checklistBeforeDone).toBe(false);
project.updateSettings('owner', {
...defaultProjectSettings(),
checklistBeforeDone: true,
});
expect(done).toThrow(/quedan 2 pasos/);
// A client that does not know about it keeps it on.
project.updateSettings('owner', defaultProjectSettings());
expect(project.workflow.checklistBeforeDone).toBe(true);
issue.updateChecklistItem('dev', 'a', { done: true });
expect(done).toThrow(/queda 1 paso/);
// An owner or admin may close it anyway.
issue.changeStatus('owner', 'DONE', null, project.workflow, true);
expect(issue.status).toBe('DONE');
project.updateSettings('owner', {
...defaultProjectSettings(),
checklistBeforeDone: false,
});
expect(project.workflow.checklistBeforeDone).toBe(false);
});
});