mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Implement file hash-based library matching and remove fuzzy ASIN matching
Adds file hash-based matching for Audiobookshelf library items to ensure 100% accurate ASIN assignment for RMAB-organized content. Removes fuzzy matching from library availability checks, making all matching ASIN-only to eliminate false positives and race conditions. Updates database schema, processors, and matcher utilities; adds new tests and documentation for the new matching strategy. Removes obsolete scripts, Dockerfile, and related tests; updates docker-compose for test environments.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Component: Active Downloads Table Tests
|
||||
* Documentation: documentation/admin-dashboard.md
|
||||
*/
|
||||
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { ActiveDownloadsTable } from '@/app/admin/components/ActiveDownloadsTable';
|
||||
|
||||
describe('ActiveDownloadsTable', () => {
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('renders an empty state when no downloads exist', () => {
|
||||
render(<ActiveDownloadsTable downloads={[]} />);
|
||||
|
||||
expect(screen.getByText('No Active Downloads')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders download details with formatted values', () => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(new Date('2024-01-01T00:00:00Z'));
|
||||
|
||||
render(
|
||||
<ActiveDownloadsTable
|
||||
downloads={[
|
||||
{
|
||||
requestId: 'req-1',
|
||||
title: 'Active Book',
|
||||
author: 'Author One',
|
||||
progress: 42,
|
||||
speed: 1024 * 1024,
|
||||
eta: 3600,
|
||||
user: 'Zach',
|
||||
startedAt: new Date('2023-12-31T23:00:00Z'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText('Active Book')).toBeInTheDocument();
|
||||
expect(screen.getByText('Author One')).toBeInTheDocument();
|
||||
expect(screen.getByText('42%')).toBeInTheDocument();
|
||||
expect(screen.getByText('1 MB/s')).toBeInTheDocument();
|
||||
expect(screen.getByText('1h 0m')).toBeInTheDocument();
|
||||
expect(screen.getByText(/ago/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user