feat: add UI components for alert dialog, badge, checkbox, dialog, label, select, sheet, table, textarea
Some checks failed
CI / lint (push) Failing after 1m5s
CI / test-backend (push) Has been skipped
CI / test-frontend (push) Has been skipped
CI / test-e2e (push) Has been skipped

- 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.
This commit is contained in:
2026-03-18 19:21:36 +01:00
parent b92cc19137
commit a07096d7c7
95 changed files with 8176 additions and 615 deletions

View File

@@ -6,8 +6,7 @@ vi.mock('../../src/services/fsScanner', () => ({ scanDirectory: vi.fn() }));
vi.mock('../../src/services/archiveReader', () => ({ streamArchiveEntry: vi.fn() }));
vi.mock('../../src/plugins/prisma', () => ({
default: {
game: { findUnique: vi.fn(), create: vi.fn() },
romFile: { upsert: vi.fn() },
game: { findFirst: vi.fn(), create: vi.fn(), update: vi.fn() },
},
}));
@@ -22,7 +21,7 @@ beforeEach(() => {
});
describe('services/importService (archive entries)', () => {
it('procesa una entrada interna usando streamArchiveEntry y hace upsert', async () => {
it('procesa una entrada interna usando streamArchiveEntry y crea Game con source=rom', async () => {
const files = [
{
path: '/roms/collection.zip::inner/rom1.bin',
@@ -41,13 +40,12 @@ describe('services/importService (archive entries)', () => {
(scanDirectory as unknown as Mock).mockResolvedValue(files);
(streamArchiveEntry as unknown as Mock).mockResolvedValue(Readable.from([data]));
(prisma.game.findUnique as unknown as Mock).mockResolvedValue(null);
(prisma.game.findFirst as unknown as Mock).mockResolvedValue(null);
(prisma.game.create as unknown as Mock).mockResolvedValue({
id: 77,
title: 'ROM1',
slug: 'rom1',
});
(prisma.romFile.upsert as unknown as Mock).mockResolvedValue({ id: 1 });
const md5 = createHash('md5').update(data).digest('hex');
@@ -57,12 +55,25 @@ describe('services/importService (archive entries)', () => {
expect((streamArchiveEntry as unknown as Mock).mock.calls[0][0]).toBe('/roms/collection.zip');
expect((streamArchiveEntry as unknown as Mock).mock.calls[0][1]).toBe('inner/rom1.bin');
expect((prisma.romFile.upsert as unknown as Mock).mock.calls.length).toBe(1);
const upsertArgs = (prisma.romFile.upsert as unknown as Mock).mock.calls[0][0];
expect(upsertArgs.where).toEqual({ checksum: md5 });
expect(upsertArgs.create.filename).toBe('rom1.bin');
expect(upsertArgs.create.path).toBe('/roms/collection.zip::inner/rom1.bin');
expect((prisma.game.findFirst as unknown as Mock).mock.calls[0][0]).toEqual({
where: { source: 'rom', romChecksum: md5 },
});
expect((prisma.game.create as unknown as Mock).mock.calls[0][0]).toEqual({
data: {
title: 'ROM1',
slug: 'rom1-1234567890123',
source: 'rom',
romPath: '/roms/collection.zip::inner/rom1.bin',
romFilename: 'rom1.bin',
romSize: 123,
romChecksum: md5,
romFormat: 'bin',
romHashes: expect.any(String),
addedAt: expect.any(Date),
lastSeenAt: expect.any(Date),
},
});
expect(summary).toEqual({ processed: 1, createdCount: 1, upserted: 1 });
expect(summary).toEqual({ processed: 1, createdCount: 1, upserted: 0 });
});
});