- Implemented AlertDialog component with overlay, content, header, footer, title, description, action, and cancel functionalities. - Created Badge component with variant support for different styles. - Developed Checkbox component with custom styling and indicator. - Added Dialog component with trigger, close, overlay, content, header, footer, title, and description. - Introduced Label component for form elements. - Built Select component with trigger, content, group, item, label, separator, and scroll buttons. - Created Sheet component with trigger, close, overlay, content, header, footer, title, and description. - Implemented Table component with header, body, footer, row, head, cell, and caption. - Added Textarea component with custom styling. - Established API service for game management with CRUD operations and metadata search functionalities. - Updated dependencies in package lock files.
76 lines
3.4 KiB
JavaScript
76 lines
3.4 KiB
JavaScript
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || (function () {
|
|
var ownKeys = function(o) {
|
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
var ar = [];
|
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
return ar;
|
|
};
|
|
return ownKeys(o);
|
|
};
|
|
return function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
})();
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const vitest_1 = require("vitest");
|
|
// Mockeamos el módulo `child_process` para controlar las llamadas a `exec`.
|
|
vitest_1.vi.mock('child_process', () => ({ exec: vitest_1.vi.fn() }));
|
|
const child_process = __importStar(require("child_process"));
|
|
const archiveReader_1 = require("../../src/services/archiveReader");
|
|
(0, vitest_1.describe)('services/archiveReader', () => {
|
|
(0, vitest_1.it)('lista entradas usando 7z -slt', async () => {
|
|
const stdout = `Path = file1.txt\nSize = 123\nPacked Size = 0\n\nPath = dir/file2.bin\nSize = 456\nPacked Size = 0\n`;
|
|
child_process.exec.mockImplementation((cmd, cb) => {
|
|
cb(null, stdout, '');
|
|
return {};
|
|
});
|
|
const entries = await (0, archiveReader_1.listArchiveEntries)('/roms/archive.7z', console);
|
|
(0, vitest_1.expect)(entries.length).toBe(2);
|
|
(0, vitest_1.expect)(entries[0].name).toBe('file1.txt');
|
|
(0, vitest_1.expect)(entries[0].size).toBe(123);
|
|
child_process.exec.mockRestore?.();
|
|
});
|
|
(0, vitest_1.it)('usa unzip como fallback para zip cuando 7z falla', async () => {
|
|
child_process.exec
|
|
.mockImplementationOnce((cmd, cb) => {
|
|
// simular fallo de 7z
|
|
cb(new Error('7z not found'), '', '');
|
|
return {};
|
|
})
|
|
.mockImplementationOnce((cmd, cb) => {
|
|
// salida simulada de unzip -l
|
|
cb(null, ' 123 file1.txt\n 456 file2.bin\n', '');
|
|
return {};
|
|
});
|
|
const entries = await (0, archiveReader_1.listArchiveEntries)('/roms/archive.zip', console);
|
|
(0, vitest_1.expect)(entries.length).toBe(2);
|
|
(0, vitest_1.expect)(entries[0].name).toBe('file1.txt');
|
|
child_process.exec.mockRestore?.();
|
|
});
|
|
(0, vitest_1.it)('retorna vacío para formatos no soportados', async () => {
|
|
const entries = await (0, archiveReader_1.listArchiveEntries)('/roms/simple.bin');
|
|
(0, vitest_1.expect)(entries).toEqual([]);
|
|
});
|
|
});
|