diff --git a/functions/core/test_db.go b/functions/core/test_db.go new file mode 100644 index 00000000..0e40dac4 --- /dev/null +++ b/functions/core/test_db.go @@ -0,0 +1,12 @@ +package core + +import ( + "database/sql" +) + +// TestDB encapsula una base de datos SQLite de test con su path y cleanup. +type TestDB struct { + DB *sql.DB + Path string + Cleanup func() +} diff --git a/functions/core/test_server.go b/functions/core/test_server.go new file mode 100644 index 00000000..baadd189 --- /dev/null +++ b/functions/core/test_server.go @@ -0,0 +1,12 @@ +package core + +import ( + "net/http" +) + +// TestServer encapsula un servidor HTTP de test con su cliente y cleanup. +type TestServer struct { + URL string + Client *http.Client + Cleanup func() +} diff --git a/types/core/test_db.md b/types/core/test_db.md new file mode 100644 index 00000000..cecd7658 --- /dev/null +++ b/types/core/test_db.md @@ -0,0 +1,23 @@ +--- +name: test_db +lang: go +domain: core +version: "1.0.0" +algebraic: product +definition: | + type TestDB struct { + DB *sql.DB + Path string + Cleanup func() + } +description: "Base de datos SQLite de test con puntero al DB abierto, path (vacio para :memory:) y funcion de cleanup para cerrar conexiones al finalizar el test." +tags: [testing, database, sqlite, test_helper] +uses_types: [] +file_path: "functions/core/test_db.go" +--- + +## Notas + +Tipo producto — todos los campos siempre presentes. Retornado por `test_db_setup_go_core`. +Path es `:memory:` para bases de datos en memoria. +Cleanup se registra automaticamente en t.Cleanup() al crear el DB. diff --git a/types/core/test_server.md b/types/core/test_server.md new file mode 100644 index 00000000..a0fdd3cd --- /dev/null +++ b/types/core/test_server.md @@ -0,0 +1,22 @@ +--- +name: test_server +lang: go +domain: core +version: "1.0.0" +algebraic: product +definition: | + type TestServer struct { + URL string + Client *http.Client + Cleanup func() + } +description: "Servidor HTTP de test con URL base, cliente preconfigurado y funcion de cleanup para liberar recursos al finalizar el test." +tags: [testing, http, server, test_helper] +uses_types: [] +file_path: "functions/core/test_server.go" +--- + +## Notas + +Tipo producto — todos los campos siempre presentes. Retornado por `test_http_server_go_core`. +Cleanup se registra automaticamente en t.Cleanup() al crear el servidor.