Skip to content

Commit 637d2cf

Browse files
wlgns5376claude
andcommitted
fix(#40): task-reassignment.test.ts의 잘못된 테스트 기대값 수정
초기 셋팅 시 리포지토리 clone 버그는 이전 커밋들(a82ca33, 89420bc, 9f42f0d)에서 이미 수정되었으나, 통합 테스트에서 잘못된 기대값으로 인해 실패하고 있었습니다. 주요 변경 사항: - TaskAssignmentValidator 테스트: 디렉토리만 있고 .git 파일이 없으면 isWorktreeValid()가 false를 반환해야 함 (기존: true 기대) - canAssignIdleWorkerToTask 테스트: 유효한 worktree를 위해 .git 파일 생성 추가 - 우선순위 시스템 테스트: 유효한 worktree를 위해 .git 파일 생성 추가 테스트 결과: - workspace 관련 테스트 50개 모두 통과 - 버그 수정 검증 완료 Closes #40 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a82ca33 commit 637d2cf

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

tests/integration/task-reassignment.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,20 @@ describe('Task Reassignment Integration Tests', () => {
242242
// When: workspace 유효성 검증
243243
const isValid = await workspaceManager.isWorktreeValid(workspaceInfo);
244244

245-
// Then: .git 파일이 없어도 디렉토리가 있으면 유효한 것으로 판단 (재사용 가능)
246-
expect(isValid).toBe(true);
245+
// Then: .git 파일이 없으면 유효하지 않은 worktree로 판단
246+
expect(isValid).toBe(false);
247247
});
248248

249249
it('WorkerPoolManager의 canAssignIdleWorkerToTask가 올바르게 작동한다', async () => {
250-
// Given: workspace가 있는 작업
250+
// Given: 유효한 worktree가 있는 작업
251251
const taskId = 'test-task-4';
252252
const workspaceInfo = await workspaceManager.createWorkspace(
253253
taskId,
254254
'test-owner/test-repo'
255255
);
256+
// 디렉토리와 .git 파일 생성 (유효한 worktree)
256257
await fs.mkdir(workspaceInfo.workspaceDir, { recursive: true });
258+
await fs.writeFile(path.join(workspaceInfo.workspaceDir, '.git'), 'gitdir: /path/to/repo/.git/worktrees/test');
257259

258260
// Given: idle 상태 Worker
259261
const worker = await workerPoolManager.getAvailableWorker();
@@ -266,29 +268,30 @@ describe('Task Reassignment Integration Tests', () => {
266268
{ id: taskId, title: '테스트 작업 4' }
267269
);
268270

269-
// Then: workspace가 있으므로 할당 가능
271+
// Then: 유효한 worktree가 있으므로 할당 가능
270272
expect(canAssign).toBe(true);
271273
});
272274

273275
it('TaskAssignmentValidator의 우선순위 시스템이 올바르게 작동한다', async () => {
274-
// Given: workspace가 있는 작업과 없는 작업
276+
// Given: 유효한 worktree가 있는 작업과 없는 작업
275277
const taskWithWorkspace = 'task-with-workspace';
276278
const taskWithoutWorkspace = 'task-without-workspace';
277279

278-
// workspace 생성
280+
// 유효한 worktree 생성 (디렉토리 + .git 파일)
279281
const workspaceInfo = await workspaceManager.createWorkspace(
280282
taskWithWorkspace,
281283
'test-owner/test-repo'
282284
);
283285
await fs.mkdir(workspaceInfo.workspaceDir, { recursive: true });
286+
await fs.writeFile(path.join(workspaceInfo.workspaceDir, '.git'), 'gitdir: /path/to/repo/.git/worktrees/test');
284287

285288
// When: 우선순위 확인
286289
const priorityWithWorkspace = await workerPoolManager['taskAssignmentValidator']
287290
.getTaskReassignmentPriority(taskWithWorkspace);
288291
const priorityWithoutWorkspace = await workerPoolManager['taskAssignmentValidator']
289292
.getTaskReassignmentPriority(taskWithoutWorkspace);
290293

291-
// Then: workspace가 있는 작업이 더 높은 우선순위를 가짐
294+
// Then: 유효한 worktree가 있는 작업이 더 높은 우선순위를 가짐
292295
expect(priorityWithWorkspace).toBe(10); // 높은 우선순위
293296
expect(priorityWithoutWorkspace).toBe(5); // 중간 우선순위
294297
});

0 commit comments

Comments
 (0)