feat: add comprehensive integration tests for auto-mode-service

- Created git-test-repo helper for managing test git repositories
- Added 13 integration tests covering:
  - Worktree operations (create, error handling, non-worktree mode)
  - Feature execution (status updates, model selection, duplicate prevention)
  - Auto loop (start/stop, pending features, max concurrency, events)
  - Error handling (provider errors, continue after failures)
- Integration tests use real git operations with temporary repos
- All 416 tests passing with 72.65% overall coverage
- Service coverage improved: agent-service 58%, auto-mode-service 44%, feature-loader 66%

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Kacper
2025-12-13 13:34:27 +01:00
parent 0473b35db3
commit 23ff99d2e2
32 changed files with 9001 additions and 3 deletions

25
apps/server/tests/fixtures/configs.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
/**
* Configuration fixtures for testing Codex config manager
*/
export const tomlConfigFixture = `
experimental_use_rmcp_client = true
[mcp_servers.automaker-tools]
command = "node"
args = ["/path/to/server.js"]
startup_timeout_sec = 10
tool_timeout_sec = 60
enabled_tools = ["UpdateFeatureStatus"]
[mcp_servers.automaker-tools.env]
AUTOMAKER_PROJECT_PATH = "/path/to/project"
`;
export const codexAuthJsonFixture = {
token: {
access_token: "test-access-token",
refresh_token: "test-refresh-token",
id_token: "test-id-token",
},
};

14
apps/server/tests/fixtures/images.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
/**
* Image fixtures for testing image handling
*/
// 1x1 transparent PNG base64 data
export const pngBase64Fixture =
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
export const imageDataFixture = {
base64: pngBase64Fixture,
mimeType: "image/png",
filename: "test.png",
originalPath: "/path/to/test.png",
};

62
apps/server/tests/fixtures/messages.ts vendored Normal file
View File

@@ -0,0 +1,62 @@
/**
* Message fixtures for testing providers and lib utilities
*/
import type {
ConversationMessage,
ProviderMessage,
ContentBlock,
} from "../../src/providers/types.js";
export const conversationHistoryFixture: ConversationMessage[] = [
{
role: "user",
content: "Hello, can you help me?",
},
{
role: "assistant",
content: "Of course! How can I assist you today?",
},
{
role: "user",
content: [
{ type: "text", text: "What is in this image?" },
{
type: "image",
source: { type: "base64", media_type: "image/png", data: "base64data" },
},
],
},
];
export const claudeProviderMessageFixture: ProviderMessage = {
type: "assistant",
message: {
role: "assistant",
content: [{ type: "text", text: "This is a test response" }],
},
};
export const codexThinkingMessageFixture = {
type: "item.completed",
item: {
type: "reasoning",
text: "I need to analyze the problem first...",
},
};
export const codexCommandExecutionFixture = {
type: "item.completed",
item: {
type: "command_execution",
command: "ls -la",
aggregated_output: "total 12\ndrwxr-xr-x 3 user user 4096 Dec 13",
},
};
export const codexErrorFixture = {
type: "error",
data: {
message: "Authentication failed",
},
};