mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
refactor(01-01): wire ConcurrencyManager into AutoModeService
- AutoModeService now delegates to ConcurrencyManager for all running feature tracking - Constructor accepts optional ConcurrencyManager for dependency injection - Remove local RunningFeature interface (imported from ConcurrencyManager) - Migrate all this.runningFeatures usages to concurrencyManager methods - Update tests to use concurrencyManager.acquire() instead of direct Map access - ConcurrencyManager accepts getCurrentBranch function for testability BREAKING: AutoModeService no longer exposes runningFeatures Map directly. Tests must use concurrencyManager.acquire() to add running features. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,22 +1,19 @@
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { ConcurrencyManager, type RunningFeature } from '@/services/concurrency-manager.js';
|
||||
|
||||
// Mock git-utils to control getCurrentBranch behavior
|
||||
vi.mock('@automaker/git-utils', () => ({
|
||||
getCurrentBranch: vi.fn(),
|
||||
}));
|
||||
|
||||
import { getCurrentBranch } from '@automaker/git-utils';
|
||||
const mockGetCurrentBranch = vi.mocked(getCurrentBranch);
|
||||
import { describe, it, expect, beforeEach, vi, type Mock } from 'vitest';
|
||||
import {
|
||||
ConcurrencyManager,
|
||||
type RunningFeature,
|
||||
type GetCurrentBranchFn,
|
||||
} from '@/services/concurrency-manager.js';
|
||||
|
||||
describe('ConcurrencyManager', () => {
|
||||
let manager: ConcurrencyManager;
|
||||
let mockGetCurrentBranch: Mock<GetCurrentBranchFn>;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
manager = new ConcurrencyManager();
|
||||
// Default: primary branch is 'main'
|
||||
mockGetCurrentBranch.mockResolvedValue('main');
|
||||
mockGetCurrentBranch = vi.fn().mockResolvedValue('main');
|
||||
manager = new ConcurrencyManager(mockGetCurrentBranch);
|
||||
});
|
||||
|
||||
describe('acquire', () => {
|
||||
|
||||
Reference in New Issue
Block a user