|
| 1 | +run "test_auggie_basic" { |
| 2 | + command = plan |
| 3 | + |
| 4 | + variables { |
| 5 | + agent_id = "test-agent-123" |
| 6 | + folder = "/home/coder/projects" |
| 7 | + } |
| 8 | + |
| 9 | + assert { |
| 10 | + condition = coder_env.auggie_session_auth.name == "AUGMENT_SESSION_AUTH" |
| 11 | + error_message = "Auggie session auth environment variable should be set correctly" |
| 12 | + } |
| 13 | + |
| 14 | + assert { |
| 15 | + condition = var.folder == "/home/coder/projects" |
| 16 | + error_message = "Folder variable should be set correctly" |
| 17 | + } |
| 18 | + |
| 19 | + assert { |
| 20 | + condition = var.agent_id == "test-agent-123" |
| 21 | + error_message = "Agent ID variable should be set correctly" |
| 22 | + } |
| 23 | + |
| 24 | + assert { |
| 25 | + condition = var.install_auggie == true |
| 26 | + error_message = "Install auggie should default to true" |
| 27 | + } |
| 28 | + |
| 29 | + assert { |
| 30 | + condition = var.install_agentapi == true |
| 31 | + error_message = "Install agentapi should default to true" |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +run "test_auggie_with_session_token" { |
| 36 | + command = plan |
| 37 | + |
| 38 | + variables { |
| 39 | + agent_id = "test-agent-456" |
| 40 | + folder = "/home/coder/workspace" |
| 41 | + augment_session_token = "test-session-token-123" |
| 42 | + } |
| 43 | + |
| 44 | + assert { |
| 45 | + condition = coder_env.auggie_session_auth.value == "test-session-token-123" |
| 46 | + error_message = "Auggie session token value should match the input" |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +run "test_auggie_with_custom_options" { |
| 51 | + command = plan |
| 52 | + |
| 53 | + variables { |
| 54 | + agent_id = "test-agent-789" |
| 55 | + folder = "/home/coder/custom" |
| 56 | + order = 5 |
| 57 | + group = "development" |
| 58 | + icon = "/icon/custom.svg" |
| 59 | + auggie_model = "gpt-4" |
| 60 | + ai_prompt = "Help me write better code" |
| 61 | + interaction_mode = "compact" |
| 62 | + continue_previous_conversation = true |
| 63 | + install_auggie = false |
| 64 | + install_agentapi = false |
| 65 | + auggie_version = "1.0.0" |
| 66 | + agentapi_version = "v0.6.0" |
| 67 | + } |
| 68 | + |
| 69 | + assert { |
| 70 | + condition = var.order == 5 |
| 71 | + error_message = "Order variable should be set to 5" |
| 72 | + } |
| 73 | + |
| 74 | + assert { |
| 75 | + condition = var.group == "development" |
| 76 | + error_message = "Group variable should be set to 'development'" |
| 77 | + } |
| 78 | + |
| 79 | + assert { |
| 80 | + condition = var.icon == "/icon/custom.svg" |
| 81 | + error_message = "Icon variable should be set to custom icon" |
| 82 | + } |
| 83 | + |
| 84 | + assert { |
| 85 | + condition = var.auggie_model == "gpt-4" |
| 86 | + error_message = "Auggie model variable should be set to 'gpt-4'" |
| 87 | + } |
| 88 | + |
| 89 | + assert { |
| 90 | + condition = var.ai_prompt == "Help me write better code" |
| 91 | + error_message = "AI prompt variable should be set correctly" |
| 92 | + } |
| 93 | + |
| 94 | + assert { |
| 95 | + condition = var.interaction_mode == "compact" |
| 96 | + error_message = "Interaction mode should be set to 'compact'" |
| 97 | + } |
| 98 | + |
| 99 | + assert { |
| 100 | + condition = var.continue_previous_conversation == true |
| 101 | + error_message = "Continue previous conversation should be set to true" |
| 102 | + } |
| 103 | + |
| 104 | + assert { |
| 105 | + condition = var.auggie_version == "1.0.0" |
| 106 | + error_message = "Auggie version should be set to '1.0.0'" |
| 107 | + } |
| 108 | + |
| 109 | + assert { |
| 110 | + condition = var.agentapi_version == "v0.6.0" |
| 111 | + error_message = "AgentAPI version should be set to 'v0.6.0'" |
| 112 | + } |
| 113 | +} |
| 114 | + |
| 115 | +run "test_auggie_with_mcp_and_rules" { |
| 116 | + command = plan |
| 117 | + |
| 118 | + variables { |
| 119 | + agent_id = "test-agent-mcp" |
| 120 | + folder = "/home/coder/mcp-test" |
| 121 | + mcp = jsonencode({ |
| 122 | + mcpServers = { |
| 123 | + test = { |
| 124 | + command = "test-server" |
| 125 | + args = ["--config", "test.json"] |
| 126 | + } |
| 127 | + } |
| 128 | + }) |
| 129 | + mcp_files = [ |
| 130 | + "/path/to/mcp1.json", |
| 131 | + "/path/to/mcp2.json" |
| 132 | + ] |
| 133 | + rules = "# General coding rules\n- Write clean code\n- Add comments" |
| 134 | + } |
| 135 | + |
| 136 | + assert { |
| 137 | + condition = var.mcp != "" |
| 138 | + error_message = "MCP configuration should be provided" |
| 139 | + } |
| 140 | + |
| 141 | + assert { |
| 142 | + condition = length(var.mcp_files) == 2 |
| 143 | + error_message = "Should have 2 MCP files" |
| 144 | + } |
| 145 | + |
| 146 | + assert { |
| 147 | + condition = var.rules != "" |
| 148 | + error_message = "Rules should be provided" |
| 149 | + } |
| 150 | +} |
| 151 | + |
| 152 | +run "test_auggie_with_scripts" { |
| 153 | + command = plan |
| 154 | + |
| 155 | + variables { |
| 156 | + agent_id = "test-agent-scripts" |
| 157 | + folder = "/home/coder/scripts" |
| 158 | + pre_install_script = "echo 'Pre-install script'" |
| 159 | + post_install_script = "echo 'Post-install script'" |
| 160 | + } |
| 161 | + |
| 162 | + assert { |
| 163 | + condition = var.pre_install_script == "echo 'Pre-install script'" |
| 164 | + error_message = "Pre-install script should be set correctly" |
| 165 | + } |
| 166 | + |
| 167 | + assert { |
| 168 | + condition = var.post_install_script == "echo 'Post-install script'" |
| 169 | + error_message = "Post-install script should be set correctly" |
| 170 | + } |
| 171 | +} |
| 172 | + |
| 173 | +run "test_auggie_interaction_mode_validation" { |
| 174 | + command = plan |
| 175 | + |
| 176 | + variables { |
| 177 | + agent_id = "test-agent-validation" |
| 178 | + folder = "/home/coder/test" |
| 179 | + interaction_mode = "print" |
| 180 | + } |
| 181 | + |
| 182 | + assert { |
| 183 | + condition = contains(["interactive", "print", "quiet", "compact"], var.interaction_mode) |
| 184 | + error_message = "Interaction mode should be one of the valid options" |
| 185 | + } |
| 186 | +} |
0 commit comments