release / govulncheck (push) Successful in 14s
release / web (push) Failing after 15s
release / go (push) Failing after 1m16s
release / integration (push) Failing after 4m49s
release / android (push) Successful in 4m59s
release / Build signed APK (releases and dev) (push) Successful in 5m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
A finished download is checked against MusicBrainz before anything is filed: the files are paired with an edition's tracks by position or path, and AcoustID, tag ids, lengths and titles say whether it is the album. What is the album is copied into the library as Artist/Album (Year)/Artist - Album - NN - Title, tagged with Picard's MusicBrainz ids, and scanned; the download keeps seeding. What is not is refused: set aside, removed from the client, and the album searched for again. A download the check cannot settle waits for a person, who imports it anyway or refuses it. Tracks the library already holds are skipped. The wanted list leaves Admin for a top-level Wanted view, admin-only and web-only, with tabs for Wanted, Activity (downloads and their imports, the ones needing a person first), Missing files, Held, Following (with the release-type profiles, moved off Integrations) and Blocked. The search settings gain "File new music into" when the library has several folders. The search pass logs why each failed search failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import { afterEach, describe, expect, test, vi } from 'vitest';
|
||
import { fireEvent, render, screen, waitFor } from '@testing-library/svelte';
|
||
import { mockInfiniteQuery } from '../../../test-utils/query';
|
||
import type { ReleaseBlock } from '#lib/api/types.js';
|
||
|
||
vi.mock('#lib/api/wanted.js', () => ({
|
||
createReleaseBlocksQuery: vi.fn(),
|
||
unblockRelease: vi.fn().mockResolvedValue(undefined)
|
||
}));
|
||
vi.mock('#lib/stores/toast.svelte.js', () => ({ pushToast: vi.fn() }));
|
||
|
||
import BlockList from './BlockList.svelte';
|
||
import { createReleaseBlocksQuery, unblockRelease } from '#lib/api/wanted.js';
|
||
|
||
const block: ReleaseBlock = {
|
||
info_hash: 'abc123',
|
||
name: 'Daft Punk - Random Access Memories (Drumless Edition)',
|
||
reason: 'import',
|
||
detail: 'The album tag says another version.',
|
||
blocked_at: new Date(Date.now() - 3_600_000).toISOString(),
|
||
want_title: 'Random Access Memories',
|
||
want_artist: 'Daft Punk'
|
||
};
|
||
|
||
afterEach(() => vi.clearAllMocks());
|
||
|
||
function setup(items: ReleaseBlock[]) {
|
||
vi.mocked(createReleaseBlocksQuery).mockReturnValue(
|
||
mockInfiniteQuery({ pages: [{ items, total: items.length, limit: 50, offset: 0 }] }) as unknown as ReturnType<
|
||
typeof createReleaseBlocksQuery
|
||
>
|
||
);
|
||
return render(BlockList);
|
||
}
|
||
|
||
describe('BlockList', () => {
|
||
test('a blocked release says why and can be allowed again', async () => {
|
||
setup([block]);
|
||
expect(screen.getByText(/refused on import/i)).toBeTruthy();
|
||
expect(screen.getByText(/another version/)).toBeTruthy();
|
||
expect(screen.getByText(/for daft punk – random access memories/i)).toBeTruthy();
|
||
await fireEvent.click(screen.getByRole('button', { name: /allow .* again/i }));
|
||
await waitFor(() => expect(unblockRelease).toHaveBeenCalledWith('abc123'));
|
||
});
|
||
|
||
test('with nothing blocked it says so', () => {
|
||
setup([]);
|
||
expect(screen.getByText(/no releases are blocked/i)).toBeTruthy();
|
||
});
|
||
});
|