(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestExtractEngineConfigWithDetails(t *testing.T) { |
| 88 | tmpDir := testutil.TempDir(t, "engine-config-details-*") |
| 89 | awInfoContent := `{ |
| 90 | "engine_id": "copilot", |
| 91 | "engine_name": "GitHub Copilot CLI", |
| 92 | "model": "gpt-4", |
| 93 | "version": "1.0.0", |
| 94 | "cli_version": "2.0.0", |
| 95 | "awf_version": "3.0.0", |
| 96 | "event_name": "issues.opened", |
| 97 | "repository": "org/repo" |
| 98 | }` |
| 99 | err := os.WriteFile(filepath.Join(tmpDir, "aw_info.json"), []byte(awInfoContent), 0644) |
| 100 | require.NoError(t, err, "Should write aw_info.json") |
| 101 | |
| 102 | result := extractEngineConfigWithInferredEngine(tmpDir, "") |
| 103 | require.NotNil(t, result, "Engine config should not be nil") |
| 104 | assert.Equal(t, "copilot", result.EngineID, "Engine ID should match") |
| 105 | assert.Equal(t, "GitHub Copilot CLI", result.EngineName, "Engine name should match") |
| 106 | assert.Equal(t, "gpt-4", result.Model, "Model should match") |
| 107 | assert.Equal(t, "1.0.0", result.Version, "Version should match") |
| 108 | assert.Equal(t, "2.0.0", result.CLIVersion, "CLI version should match") |
| 109 | assert.Equal(t, "3.0.0", result.FirewallVersion, "Firewall version should match") |
| 110 | assert.Equal(t, "issues.opened", result.TriggerEvent, "Trigger event should match") |
| 111 | assert.Equal(t, "org/repo", result.Repository, "Repository should match") |
| 112 | } |
| 113 | |
| 114 | func TestExtractEngineConfigInferredWithoutAwInfo(t *testing.T) { |
| 115 | tmpDir := testutil.TempDir(t, "engine-infer-*") |
nothing calls this directly
no test coverage detected