[testify-expert] Improve Test Quality: pkg/workflow/safe_outputs_config_helpers_test.go
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 73/100
Línea de trabajo
Lee pkg/workflow/safe_outputs_config_helpers_test.go junto con pkg/workflow/safe_outputs_config_helpers.go; empieza añadiendo casos directos para buildNormalizedSortedJSON y casos en tabla para buildCustomSafeOutputJobsJSON. Mueve TestUsesPatchesAndCheckouts a safe_outputs_runtime_test.go, tal como se solicita. La tarea estará terminada cuando se cubra la lista de verificación y make test-unit pase.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Current State
- Test file:
pkg/workflow/safe_outputs_config_helpers_test.go(178 LOC, 3 test functions) - Source pair:
pkg/workflow/safe_outputs_config_helpers.go(61 LOC;buildNormalizedSortedJSON,buildCustomSafeOutputJobsJSON) - Note:
TestUsesPatchesAndCheckoutstargetsusesPatchesAndCheckoutsinsafe_outputs_runtime.go, not this file's source.
Strengths
- Good table-driven
TestUsesPatchesAndCheckoutscovering nil, staged (global and per-handler), and mixed cases. - Uses
requirefor preconditions andassert.JSONEqfor JSON comparison.
Prioritized Improvements
1. Missing high-value tests
buildNormalizedSortedJSONhas no direct test. Add table-driven cases: empty/nilnames; name normalization (e.g."my-job"→my_job); duplicate names that normalize to the same key (collapse to one);valueFnreceiving the normalized name; deterministic output across repeated calls.buildCustomSafeOutputJobsJSON: add a case for a single job, a job name with uppercase or special characters, and anilJobsmap vs an empty map.- Move
TestUsesPatchesAndCheckoutsintosafe_outputs_runtime_test.goto match its source file.
2. Testify assertion upgrades
Details
- In
TestBuildCustomSafeOutputJobsJSON, the trailingjson.Unmarshal+assert.Empty(result[...])is redundant withassert.JSONEq. Replace it withassert.Len(t, result, 2)or drop it.assert.Emptyon a missing key also passes, so it proves nothing. TestBuildCustomSafeOutputJobsJSONEmpty: useassert.Equal(t, "", ...)with messages, or make it table-driven.- Add messages to assertions that lack them.
3. Table-driven refactors
Details
Before:
assert.Empty(t, buildCustomSafeOutputJobsJSON(&WorkflowData{SafeOutputs: &SafeOutputsConfig{}}))
assert.Empty(t, buildCustomSafeOutputJobsJSON(&WorkflowData{SafeOutputs: nil}))
After:
tests := []struct{ name string; data *WorkflowData; want string }{
{"nil safe outputs", &WorkflowData{}, ""},
{"empty jobs", &WorkflowData{SafeOutputs: &SafeOutputsConfig{}}, ""},
{"two jobs", &WorkflowData{SafeOutputs: &SafeOutputsConfig{Jobs: map[string]*SafeJobConfig{"z-job": {}, "a-job": {}}}}, `{"a_job":"","z_job":""}`},
}
Merge TestBuildCustomSafeOutputJobsJSON and ...Empty into one table with t.Run.
4. Organization/readability
Details
- Split file by source (runtime vs config helpers).
- Consider a small helper to build a staged
BaseSafeOutputConfigto cut repeatedtemplatableBoolPtr("true")literals.
Acceptance Checklist
- Add direct tests for
buildNormalizedSortedJSON - Merge the two
buildCustomSafeOutputJobsJSONtests into one table - Remove redundant unmarshal assertions
- Move
TestUsesPatchesAndCheckoutsnext to its source -
make test-unitpasses
Generated by 🧪 Daily Testify Uber Super Expert · copilot · auto (Claude Sonnet 5.5) · ~15 AIC · ⌖ ~1 AIC · ⊞ 9.5K · ◷
- expires on Nov 8, 2026, 10:05 AM UTC-08:00
- Lenguaje dominante
- Go
- Estrellas
- 5.6k
- Forks
- 615
- Merge medio
- 5 h 51 min
- PR fusionados (30 d)
- 793
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/gh-aw
-
agent-research
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
automated-analysis code-quality cookie refactoring
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
cookie dependencies go
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
automation cookie
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows automation aw-essential cookie
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
Todos los issues de github/gh-aw
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/TypeScript#65370 ·
Los mantenedores suelen responder en 1 día
-
bug tech debt testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
aws/amazon-vpc-cni-k8s#3976 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
txn2/mcp-data-platform#2522 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
open-telemetry/opentelemetry-go-contrib#10234 ·
Los mantenedores suelen responder en 1 día
-
discovery/backoff: default FindPeers limit yields no fresh peersPosiblemente ocupada @zakazaka95 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100