Skip to content

Commit a2c1a02

Browse files
committed
fix: corregir configuración de mocks en pruebas de servicios para fs-extra
1 parent f5d558e commit a2c1a02

File tree

13 files changed

+1735
-794
lines changed

13 files changed

+1735
-794
lines changed

cli/index.js

Lines changed: 242 additions & 103 deletions
Large diffs are not rendered by default.

cli/services/base-service.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/**
2-
* Base Service para Agent Rules Kit
3-
* Proporciona funcionalidades compartidas para todos los servicios
2+
* Base Service for Agent Rules Kit
3+
* Provides shared functionality for all services
44
*/
55
import chalk from 'chalk';
66
import fs from 'fs-extra';
77

88
/**
9-
* Servicio base que proporciona utilidades compartidas
9+
* Base service that provides shared utilities
1010
*/
1111
export class BaseService {
1212
constructor(options = {}) {
1313
this.debug = options.debug || false;
1414
}
1515

1616
/**
17-
* Debug log helper - Centralizado para todos los servicios
18-
* @param {...any} args - Argumentos para loguear
17+
* Debug log helper - Centralized for all services
18+
* @param {...any} args - Arguments to log
1919
*/
2020
debugLog(...args) {
2121
if (this.debug) {
@@ -24,62 +24,62 @@ export class BaseService {
2424
}
2525

2626
/**
27-
* Comprueba si un directorio existe
28-
* @param {string} dir - Ruta del directorio a comprobar
29-
* @returns {boolean} - true si existe, false si no
27+
* Checks if a directory exists
28+
* @param {string} dir - Path of the directory to check
29+
* @returns {boolean} - true if it exists, false if not
3030
*/
3131
directoryExists(dir) {
3232
return fs.existsSync(dir);
3333
}
3434

3535
/**
36-
* Asegura que un directorio existe, creándolo si es necesario
37-
* @param {string} dir - Ruta del directorio a crear
36+
* Ensures a directory exists, creating it if necessary
37+
* @param {string} dir - Path of the directory to create
3838
*/
3939
ensureDirectoryExists(dir) {
4040
fs.ensureDirSync(dir);
4141
}
4242

4343
/**
44-
* Obtiene los archivos de un directorio
45-
* @param {string} dir - Ruta del directorio
46-
* @returns {Array<string>} - Lista de archivos
44+
* Gets the files in a directory
45+
* @param {string} dir - Directory path
46+
* @returns {Array<string>} - List of files
4747
*/
4848
getFilesInDirectory(dir) {
4949
if (!this.directoryExists(dir)) {
50-
this.debugLog(`Directorio no encontrado: ${dir}`);
50+
this.debugLog(`Directory not found: ${dir}`);
5151
return [];
5252
}
5353

5454
return fs.readdirSync(dir);
5555
}
5656

5757
/**
58-
* Lee un archivo
59-
* @param {string} file - Ruta del archivo a leer
60-
* @returns {string} - Contenido del archivo
58+
* Reads a file
59+
* @param {string} file - Path of the file to read
60+
* @returns {string} - File contents
6161
*/
6262
readFile(file) {
6363
return fs.readFileSync(file, 'utf8');
6464
}
6565

6666
/**
67-
* Escribe un archivo
68-
* @param {string} file - Ruta del archivo a escribir
69-
* @param {string} content - Contenido a escribir
67+
* Writes a file
68+
* @param {string} file - Path of the file to write
69+
* @param {string} content - Content to write
7070
*/
7171
writeFile(file, content) {
7272
fs.outputFileSync(file, content);
73-
this.debugLog(`Archivo creado: ${chalk.green(file)}`);
73+
this.debugLog(`File created: ${chalk.green(file)}`);
7474
}
7575

7676
/**
77-
* Copia un archivo
78-
* @param {string} src - Archivo fuente
79-
* @param {string} dest - Destino
77+
* Copies a file
78+
* @param {string} src - Source file
79+
* @param {string} dest - Destination
8080
*/
8181
copyFile(src, dest) {
8282
fs.copyFileSync(src, dest);
83-
this.debugLog(`Archivo copiado: ${chalk.green(dest)}`);
83+
this.debugLog(`File copied: ${chalk.green(dest)}`);
8484
}
8585
}

0 commit comments

Comments
 (0)