takt: tasuku-takt-list-komandoni-iss (#335)
This commit is contained in:
parent
4a7dea48ca
commit
f307ed80f0
@ -37,6 +37,30 @@ describe('formatTaskStatusLabel', () => {
|
|||||||
const task = makeTask({ kind: 'running', name: 'my-task' });
|
const task = makeTask({ kind: 'running', name: 'my-task' });
|
||||||
expect(formatTaskStatusLabel(task)).toBe('[running] my-task');
|
expect(formatTaskStatusLabel(task)).toBe('[running] my-task');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should include issue number when present', () => {
|
||||||
|
const task = makeTask({
|
||||||
|
kind: 'pending',
|
||||||
|
name: 'implement-feature',
|
||||||
|
issueNumber: 32,
|
||||||
|
});
|
||||||
|
expect(formatTaskStatusLabel(task)).toBe('[pending] implement-feature #32');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include issue number with branch when both present', () => {
|
||||||
|
const task = makeTask({
|
||||||
|
kind: 'completed',
|
||||||
|
name: 'fix-bug',
|
||||||
|
issueNumber: 42,
|
||||||
|
branch: 'takt/42/fix-bug',
|
||||||
|
});
|
||||||
|
expect(formatTaskStatusLabel(task)).toBe('[completed] fix-bug #42 (takt/42/fix-bug)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not include issue number when absent', () => {
|
||||||
|
const task = makeTask({ kind: 'pending', name: 'my-task' });
|
||||||
|
expect(formatTaskStatusLabel(task)).toBe('[pending] my-task');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('formatShortDate', () => {
|
describe('formatShortDate', () => {
|
||||||
|
|||||||
@ -8,7 +8,10 @@ const TASK_STATUS_BY_KIND: Record<TaskListItem['kind'], string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function formatTaskStatusLabel(task: TaskListItem): string {
|
export function formatTaskStatusLabel(task: TaskListItem): string {
|
||||||
const status = `[${TASK_STATUS_BY_KIND[task.kind]}] ${task.name}`;
|
let status = `[${TASK_STATUS_BY_KIND[task.kind]}] ${task.name}`;
|
||||||
|
if (task.issueNumber !== undefined) {
|
||||||
|
status += ` #${task.issueNumber}`;
|
||||||
|
}
|
||||||
if (task.branch) {
|
if (task.branch) {
|
||||||
return `${status} (${task.branch})`;
|
return `${status} (${task.branch})`;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,6 +127,7 @@ function toBaseTaskListItem(projectDir: string, tasksFile: string, task: TaskRec
|
|||||||
completedAt: task.completed_at ?? undefined,
|
completedAt: task.completed_at ?? undefined,
|
||||||
ownerPid: task.owner_pid ?? undefined,
|
ownerPid: task.owner_pid ?? undefined,
|
||||||
data: toTaskData(projectDir, task),
|
data: toTaskData(projectDir, task),
|
||||||
|
issueNumber: task.issue,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -92,4 +92,5 @@ export interface TaskListItem {
|
|||||||
startedAt?: string;
|
startedAt?: string;
|
||||||
completedAt?: string;
|
completedAt?: string;
|
||||||
ownerPid?: number;
|
ownerPid?: number;
|
||||||
|
issueNumber?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user