test: invented artists, albums and MusicBrainz ids in place of real ones
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
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
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
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
Test data and example comments named real artists, records and songs, and carried real MusicBrainz ids. One mapping swaps them for invented ones throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping what each case tests: sort order, index letter, escaping, title keys, artist-prefix stripping. A test username is no longer the operator's name. The cover-art and Last.fm connection checks still query real releases; they reach live services and need something that exists there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,11 +14,11 @@ vi.mock('#lib/api/admin.js', () => ({
|
||||
dismissDuplicateGroup: vi.fn().mockResolvedValue(undefined),
|
||||
mergeDuplicateGroup: vi.fn().mockResolvedValue({
|
||||
survivor_track_id: 'www-01',
|
||||
removed_paths: ['/music/Moe Shop/WWW (2020)/www-02.mp3']
|
||||
removed_paths: ['/music/Mochi Shop/XYZ (2020)/www-02.mp3']
|
||||
}),
|
||||
removeWrongSlotFiles: vi.fn().mockResolvedValue({
|
||||
kept_track_id: null,
|
||||
removed_paths: ['/music/Moe Shop/WWW (2020)/www-01.mp3', '/music/Moe Shop/WWW (2020)/www-02.mp3']
|
||||
removed_paths: ['/music/Mochi Shop/XYZ (2020)/www-01.mp3', '/music/Mochi Shop/XYZ (2020)/www-02.mp3']
|
||||
})
|
||||
}));
|
||||
vi.mock('#lib/player/store.svelte.js', () => ({ playQueue: vi.fn() }));
|
||||
@@ -51,12 +51,12 @@ const allFingerprinted = { total: 1200, fingerprinted: 1200, rejected: 0, pendin
|
||||
function member(id: string, extra: Partial<AdminDuplicatesResponse['groups'][number]['members'][number]> = {}) {
|
||||
return {
|
||||
track_id: id,
|
||||
title: 'WWW',
|
||||
title: 'XYZ',
|
||||
artist_id: 'ar-1',
|
||||
artist_name: 'Moe Shop',
|
||||
artist_name: 'Mochi Shop',
|
||||
album_id: 'al-1',
|
||||
album_title: 'WWW',
|
||||
file_path: `/music/Moe Shop/WWW (2020)/${id}.mp3`,
|
||||
album_title: 'XYZ',
|
||||
file_path: `/music/Mochi Shop/XYZ (2020)/${id}.mp3`,
|
||||
file_format: 'mp3',
|
||||
file_size: 6_900_000,
|
||||
duration_sec: 215,
|
||||
@@ -199,14 +199,14 @@ describe('admin duplicates', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// Identical audio titled "WWW" and "WWW (instrumental)". One file
|
||||
// Identical audio titled "XYZ" and "XYZ (instrumental)". One file
|
||||
// claimed to be the vocal and wasn't, and nothing said the vocal was missing.
|
||||
describe('identical audio under different titles', () => {
|
||||
function www() {
|
||||
const r = response();
|
||||
r.groups[0] = {
|
||||
...r.groups[0],
|
||||
members: [member('www-01'), member('www-02', { title: 'WWW (instrumental)' })]
|
||||
members: [member('www-01'), member('www-02', { title: 'XYZ (instrumental)' })]
|
||||
};
|
||||
return r;
|
||||
}
|
||||
@@ -214,16 +214,16 @@ describe('admin duplicates', () => {
|
||||
test('says the copies are titled differently and names both titles', () => {
|
||||
renderWith(www());
|
||||
const notice = text(screen.getByTestId('title-mismatch'));
|
||||
expect(notice).toContain('titled “WWW” and “WWW (instrumental)”');
|
||||
expect(notice).toContain('titled “XYZ” and “XYZ (instrumental)”');
|
||||
expect(notice).toContain("isn't in your library");
|
||||
});
|
||||
|
||||
test('three different titles are all named', () => {
|
||||
const r = www();
|
||||
r.groups[0].members.push(member('www-03', { title: 'WWW (Radio Edit)' }));
|
||||
r.groups[0].members.push(member('www-03', { title: 'XYZ (Radio Edit)' }));
|
||||
renderWith(r);
|
||||
expect(text(screen.getByTestId('title-mismatch'))).toContain(
|
||||
'“WWW”, “WWW (instrumental)” and “WWW (Radio Edit)”'
|
||||
'“XYZ”, “XYZ (instrumental)” and “XYZ (Radio Edit)”'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -232,7 +232,7 @@ describe('admin duplicates', () => {
|
||||
r.groups[0] = {
|
||||
...r.groups[0],
|
||||
members: [
|
||||
member('www-01', { title: 'WWW (Instrumental)' }),
|
||||
member('www-01', { title: 'XYZ (Instrumental)' }),
|
||||
member('www-02', { title: ' www (instrumental) ' })
|
||||
]
|
||||
};
|
||||
@@ -253,14 +253,14 @@ describe('admin duplicates', () => {
|
||||
expect(screen.queryByTestId('title-mismatch')).toBeNull();
|
||||
});
|
||||
|
||||
// Unless the resolver found different songs on one album: Savant's Mortals
|
||||
// Unless the resolver found different songs on one album: Savanta's Immortals
|
||||
// held one recording as 16 tracks, each cut to its own song's length.
|
||||
test('an acoustic group the resolver found to be different songs says so', () => {
|
||||
const r = www();
|
||||
r.groups[0] = { ...r.groups[0], tier: 'acoustic', worst_bit_error_rate: 0, class: 'mismatch' };
|
||||
renderWith(r);
|
||||
const notice = text(screen.getByTestId('title-mismatch'));
|
||||
expect(notice).toContain('The music is the same, but the copies are titled “WWW” and “WWW (instrumental)”');
|
||||
expect(notice).toContain('The music is the same, but the copies are titled “XYZ” and “XYZ (instrumental)”');
|
||||
expect(notice).toContain("If you can't tell, get the album again");
|
||||
});
|
||||
});
|
||||
@@ -276,7 +276,7 @@ describe('admin duplicates', () => {
|
||||
tier: 'acoustic',
|
||||
worst_bit_error_rate: 0.04,
|
||||
class: 'mismatch',
|
||||
members: [member('www-01'), member('www-02', { title: 'WWW (instrumental)' })]
|
||||
members: [member('www-01'), member('www-02', { title: 'XYZ (instrumental)' })]
|
||||
};
|
||||
return r;
|
||||
}
|
||||
@@ -303,11 +303,11 @@ describe('admin duplicates', () => {
|
||||
|
||||
test('naming the song keeps that copy and removes the others', async () => {
|
||||
renderWith(slots());
|
||||
await fireEvent.click(screen.getByRole('radio', { name: /This is WWW \(instrumental\)/ }));
|
||||
await fireEvent.click(screen.getByRole('radio', { name: /This is XYZ \(instrumental\)/ }));
|
||||
expect(screen.getByTestId('song-badge')).toBeTruthy();
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Keep “WWW (instrumental)”…' }));
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Keep “XYZ (instrumental)”…' }));
|
||||
expect(text(screen.getByTestId('refetch-confirm'))).toContain(
|
||||
'The copy titled “WWW (instrumental)” stays, and 1 copy under other titles will be deleted from disk'
|
||||
'The copy titled “XYZ (instrumental)” stays, and 1 copy under other titles will be deleted from disk'
|
||||
);
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Remove 1 file' }));
|
||||
expect(removeWrongSlotFiles).toHaveBeenCalledWith('g-1', { keep_track_id: 'www-02' });
|
||||
@@ -443,15 +443,15 @@ describe('admin duplicates', () => {
|
||||
action: 'duplicate_merge',
|
||||
created_at: ago(HOUR),
|
||||
details: {
|
||||
survivor_path: '/music/Gorillaz/Humanz (2017)/03 - Saturnz Barz.mp3',
|
||||
survivor_path: '/music/Plastic Apes/Mammalz (2017)/03 - Neptunez Barz.mp3',
|
||||
survivor_reason: 'the copy that is not a video rip',
|
||||
removed: [{ track_id: 't-2', file_path: '/music/Gorillaz/Humanz (2017)/03 - Saturnz Barz (Official Video).mp3' }]
|
||||
removed: [{ track_id: 't-2', file_path: '/music/Plastic Apes/Mammalz (2017)/03 - Neptunez Barz (Official Video).mp3' }]
|
||||
}
|
||||
}
|
||||
]);
|
||||
await fireEvent.click(screen.getByRole('tab', { name: /resolved automatically/i }));
|
||||
const items = screen.getAllByTestId('resolved-item').map(text);
|
||||
expect(items[0]).toContain('Kept 03 - Saturnz Barz.mp3 (the copy that is not a video rip) and removed 1 file.');
|
||||
expect(items[0]).toContain('Kept 03 - Neptunez Barz.mp3 (the copy that is not a video rip) and removed 1 file.');
|
||||
expect(screen.queryByTestId('duplicate-group')).toBeNull();
|
||||
});
|
||||
|
||||
@@ -461,16 +461,16 @@ describe('admin duplicates', () => {
|
||||
id: 'a-2',
|
||||
action: 'duplicate_dismiss',
|
||||
created_at: ago(HOUR),
|
||||
details: { artist: 'Moe Shop', titles: ['Lovesick', 'Lovesick (Instrumental)'] }
|
||||
details: { artist: 'Mochi Shop', titles: ['Homesick', 'Homesick (Instrumental)'] }
|
||||
},
|
||||
{
|
||||
id: 'a-3',
|
||||
action: 'duplicate_wrong_file',
|
||||
created_at: ago(HOUR),
|
||||
details: {
|
||||
artist: 'Savant',
|
||||
artist: 'Savanta',
|
||||
kept_title: 'Void',
|
||||
removed: [{ track_id: 't-9', file_path: '/data/Music/Savant/Void/17 - Reach.m4a', title: 'Reach' }]
|
||||
removed: [{ track_id: 't-9', file_path: '/data/Music/Savanta/Void/17 - Reach.m4a', title: 'Reach' }]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -478,23 +478,23 @@ describe('admin duplicates', () => {
|
||||
action: 'duplicate_wrong_file',
|
||||
created_at: ago(HOUR),
|
||||
details: {
|
||||
artist: 'Shnabubula',
|
||||
artist: 'Shnorkelbub',
|
||||
removed: [
|
||||
{ track_id: 't-5', file_path: '/data/Music/Shnabubula/05 - Fading Light.mp3', title: 'Fading Light' },
|
||||
{ track_id: 't-10', file_path: '/data/Music/Shnabubula/10 - Looking for Answers.mp3', title: 'Looking for Answers' }
|
||||
{ track_id: 't-5', file_path: '/data/Music/Shnorkelbub/05 - Fading Light.mp3', title: 'Fading Light' },
|
||||
{ track_id: 't-10', file_path: '/data/Music/Shnorkelbub/10 - Looking for Answers.mp3', title: 'Looking for Answers' }
|
||||
]
|
||||
}
|
||||
}
|
||||
]);
|
||||
await fireEvent.click(screen.getByRole('tab', { name: /resolved automatically/i }));
|
||||
const items = screen.getAllByTestId('resolved-item').map(text);
|
||||
expect(items[0]).toContain('Moe Shop: Lovesick and Lovesick (Instrumental) are different versions, not duplicates. Both kept.');
|
||||
expect(items[0]).toContain('Mochi Shop: Homesick and Homesick (Instrumental) are different versions, not duplicates. Both kept.');
|
||||
expect(items[1]).toContain(
|
||||
'Savant: the recording of Void was also filed as Reach. Removed from there; those tracks wait in Needs a file.'
|
||||
'Savanta: the recording of Void was also filed as Reach. Removed from there; those tracks wait in Needs a file.'
|
||||
);
|
||||
expect(items[1]).toContain('/data/Music/Savant/Void/17 - Reach.m4a');
|
||||
expect(items[1]).toContain('/data/Music/Savanta/Void/17 - Reach.m4a');
|
||||
expect(items[2]).toContain(
|
||||
'Shnabubula: one recording was filed as Fading Light and Looking for Answers, and it is none of them. Removed; those tracks wait in Needs a file.'
|
||||
'Shnorkelbub: one recording was filed as Fading Light and Looking for Answers, and it is none of them. Removed; those tracks wait in Needs a file.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,10 +22,10 @@ function track(
|
||||
track_id: `t-${title}`,
|
||||
title,
|
||||
artist_id: 'ar-1',
|
||||
artist_name: 'Linkin Park',
|
||||
artist_name: 'Lincoln Yard',
|
||||
album_id: 'al-1',
|
||||
album_title: 'Minutes to Midnight',
|
||||
file_path: `/music/Linkin Park/Minutes to Midnight/${title}.flac`,
|
||||
album_title: 'Minutes to Noon',
|
||||
file_path: `/music/Lincoln Yard/Minutes to Noon/${title}.flac`,
|
||||
duration_sec: 185,
|
||||
disc_number: 1,
|
||||
track_number: 1,
|
||||
@@ -44,7 +44,7 @@ const response: AdminMissingResponse = {
|
||||
offset: 0,
|
||||
groups: [
|
||||
{
|
||||
directory: '/music/Linkin Park/Minutes to Midnight',
|
||||
directory: '/music/Lincoln Yard/Minutes to Noon',
|
||||
missing_since: new Date(Date.now() - 3 * DAY).toISOString(),
|
||||
tracks: [
|
||||
track('Given Up', { lastPlayed: new Date(Date.now() - 2 * DAY).toISOString() }),
|
||||
@@ -52,7 +52,7 @@ const response: AdminMissingResponse = {
|
||||
]
|
||||
},
|
||||
{
|
||||
directory: '/music/Boards of Canada/Geogaddi',
|
||||
directory: '/music/Fields of Ontario/Geomantic',
|
||||
missing_since: new Date(Date.now() - 9 * DAY).toISOString(),
|
||||
tracks: [track('1969')]
|
||||
}
|
||||
@@ -71,8 +71,8 @@ function renderWith(data: AdminMissingResponse | undefined, extra = {}) {
|
||||
describe('/collection/missing', () => {
|
||||
test('groups rows under their directory', () => {
|
||||
renderWith(response);
|
||||
expect(screen.getByText('/music/Linkin Park/Minutes to Midnight')).toBeTruthy();
|
||||
expect(screen.getByText('/music/Boards of Canada/Geogaddi')).toBeTruthy();
|
||||
expect(screen.getByText('/music/Lincoln Yard/Minutes to Noon')).toBeTruthy();
|
||||
expect(screen.getByText('/music/Fields of Ontario/Geomantic')).toBeTruthy();
|
||||
expect(screen.getAllByTestId('missing-track-row')).toHaveLength(3);
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ describe('/collection/missing', () => {
|
||||
test('Forget all takes the whole folder', async () => {
|
||||
renderWith(response);
|
||||
await fireEvent.click(
|
||||
screen.getByRole('button', { name: 'Forget the 2 tracks in /music/Linkin Park/Minutes to Midnight' })
|
||||
screen.getByRole('button', { name: 'Forget the 2 tracks in /music/Lincoln Yard/Minutes to Noon' })
|
||||
);
|
||||
await fireEvent.click(within(screen.getByRole('dialog')).getByRole('button', { name: /confirm forget/i }));
|
||||
await waitFor(() => expect(forgetMissingTracks).toHaveBeenCalledWith(['t-Given Up', 't-Bleed It Out']));
|
||||
|
||||
@@ -29,9 +29,9 @@ const hoursAgo = (h: number) => new Date(Date.now() - h * 3_600_000).toISOString
|
||||
|
||||
const flagged: AdminQuarantineRow = {
|
||||
track_id: 't1',
|
||||
track_title: 'Roygbiv',
|
||||
artist_name: 'Boards of Canada',
|
||||
album_title: 'Geogaddi',
|
||||
track_title: 'Prismatic',
|
||||
artist_name: 'Fields of Ontario',
|
||||
album_title: 'Geomantic',
|
||||
album_id: 'al1',
|
||||
report_count: 1,
|
||||
latest_at: hoursAgo(5),
|
||||
@@ -49,7 +49,7 @@ const failure = (id: string, track: string, title: string, h: number): AdminPlay
|
||||
occurred_at: hoursAgo(h),
|
||||
track_title: title,
|
||||
track_file_path: `/music/${title}.flac`,
|
||||
artist_name: 'Annadale',
|
||||
artist_name: 'Ashdale',
|
||||
album_title: 'Dial Tone',
|
||||
album_id: 'al2'
|
||||
});
|
||||
@@ -67,7 +67,7 @@ function setup(q: AdminQuarantineRow[], e: AdminPlaybackError[], opts: { error?:
|
||||
|
||||
describe('/collection/reports', () => {
|
||||
test('a flagged track and a track that failed to play are one list, one row per track, newest first', () => {
|
||||
setup([flagged], [failure('e1', 't1', 'Roygbiv', 1), failure('e2', 't2', 'Intro', 9)]);
|
||||
setup([flagged], [failure('e1', 't1', 'Prismatic', 1), failure('e2', 't2', 'Intro', 9)]);
|
||||
const rows = screen.getAllByTestId('report-row');
|
||||
expect(rows).toHaveLength(2);
|
||||
expect(screen.getByTestId('reports-verdict').textContent).toMatch(/2 tracks need a look/);
|
||||
@@ -78,8 +78,8 @@ describe('/collection/reports', () => {
|
||||
});
|
||||
|
||||
test('Resolve clears the listeners\' reports and marks the playback errors fixed', async () => {
|
||||
setup([flagged], [failure('e1', 't1', 'Roygbiv', 1)]);
|
||||
await fireEvent.click(screen.getByRole('button', { name: /resolve roygbiv/i }));
|
||||
setup([flagged], [failure('e1', 't1', 'Prismatic', 1)]);
|
||||
await fireEvent.click(screen.getByRole('button', { name: /resolve prismatic/i }));
|
||||
await waitFor(() => expect(resolveQuarantine).toHaveBeenCalledWith('t1'));
|
||||
await waitFor(() => expect(resolvePlaybackError).toHaveBeenCalledWith('e1', 'fixed'));
|
||||
});
|
||||
@@ -110,20 +110,20 @@ describe('/collection/reports', () => {
|
||||
|
||||
test("on a phone the row's other actions are in its menu", async () => {
|
||||
setup([flagged], [failure('e2', 't2', 'Intro', 2)]);
|
||||
const roygbiv = screen.getAllByTestId('report-row').find((r) => r.textContent?.includes('Roygbiv'))!;
|
||||
await fireEvent.click(within(roygbiv).getByRole('button', { name: /more actions/i }));
|
||||
const prismatic = screen.getAllByTestId('report-row').find((r) => r.textContent?.includes('Prismatic'))!;
|
||||
await fireEvent.click(within(prismatic).getByRole('button', { name: /more actions/i }));
|
||||
const menu = within(screen.getByRole('menu'));
|
||||
expect(menu.getByText('Remove the file')).toBeInTheDocument();
|
||||
expect(menu.getByText('Remove from library')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('details show who flagged it, who it failed for, and the file', async () => {
|
||||
setup([flagged], [failure('e1', 't1', 'Roygbiv', 1)]);
|
||||
setup([flagged], [failure('e1', 't1', 'Prismatic', 1)]);
|
||||
await fireEvent.click(screen.getByRole('button', { name: /^details$/i }));
|
||||
const details = screen.getByTestId('report-details').textContent?.replace(/\s+/g, ' ');
|
||||
expect(details).toMatch(/alice flagged it · Bad rip · crackles/);
|
||||
expect(details).toMatch(/Failed to play for bob · Wouldn't load/);
|
||||
expect(details).toMatch(/\/music\/Roygbiv\.flac/);
|
||||
expect(details).toMatch(/\/music\/Prismatic\.flac/);
|
||||
});
|
||||
|
||||
test('a load failure says so with Try again, and an empty queue says nothing waits', () => {
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
// Disc and track are shown because junk numbering is the other half of
|
||||
// the symptom: Humanz's rips were spread over discs 1 to 15.
|
||||
// the symptom: Mammalz's rips were spread over discs 1 to 15.
|
||||
function position(t: AdminSuspectTrack): string {
|
||||
const parts: string[] = [];
|
||||
if (t.disc_number != null) parts.push(`disc ${t.disc_number}`);
|
||||
|
||||
@@ -14,17 +14,17 @@ import { createSuspectSourcesQuery, removeSuspectFile, setSuspectVerdict } from
|
||||
|
||||
const mocked = createSuspectSourcesQuery as ReturnType<typeof vi.fn>;
|
||||
|
||||
const HUMANZ = '/music/Gorillaz/Humanz (2017)';
|
||||
const MAMMALZ = '/music/Plastic Apes/Mammalz (2017)';
|
||||
|
||||
function track(title: string, file: string, markers: string[], disc: number | null = 15): AdminSuspectTrack {
|
||||
return {
|
||||
track_id: `t-${title}`,
|
||||
title,
|
||||
artist_id: 'ar-1',
|
||||
artist_name: 'Gorillaz',
|
||||
artist_name: 'Plastic Apes',
|
||||
album_id: 'al-1',
|
||||
album_title: 'Humanz',
|
||||
file_path: `${HUMANZ}/${file}`,
|
||||
album_title: 'Mammalz',
|
||||
file_path: `${MAMMALZ}/${file}`,
|
||||
duration_sec: 180,
|
||||
disc_number: disc,
|
||||
track_number: 4,
|
||||
@@ -59,10 +59,10 @@ describe('Suspect sources page', () => {
|
||||
infinite([
|
||||
page(0, 2, [
|
||||
{
|
||||
directory: HUMANZ,
|
||||
directory: MAMMALZ,
|
||||
tracks: [
|
||||
track('Strobelite', 'Gorillaz - Strobelite (Official Video).mp3', ['music video']),
|
||||
track('Andromeda', 'Gorillaz - Andromeda [Audio] [HQ].mp3', ['[Audio]', '[HD]'])
|
||||
track('Strobeline', 'Plastic Apes - Strobeline (Official Video).mp3', ['music video']),
|
||||
track('Cassiopeia', 'Plastic Apes - Cassiopeia [Audio] [HQ].mp3', ['[Audio]', '[HD]'])
|
||||
]
|
||||
}
|
||||
])
|
||||
@@ -71,8 +71,8 @@ describe('Suspect sources page', () => {
|
||||
render(SuspectSourcesPage);
|
||||
|
||||
expect(screen.getByTestId('suspect-count-pill')).toHaveTextContent('2');
|
||||
expect(screen.getByText(HUMANZ)).toBeInTheDocument();
|
||||
expect(screen.getByText('Gorillaz - Strobelite (Official Video).mp3')).toBeInTheDocument();
|
||||
expect(screen.getByText(MAMMALZ)).toBeInTheDocument();
|
||||
expect(screen.getByText('Plastic Apes - Strobeline (Official Video).mp3')).toBeInTheDocument();
|
||||
expect(screen.getAllByTestId('suspect-marker').map((m) => m.textContent)).toEqual([
|
||||
'music video',
|
||||
'[Audio]',
|
||||
@@ -85,16 +85,16 @@ describe('Suspect sources page', () => {
|
||||
test('joins a folder that straddles a page boundary', () => {
|
||||
mocked.mockReturnValue(
|
||||
infinite([
|
||||
page(0, 3, [{ directory: HUMANZ, tracks: [track('Strobelite', 'a (Official Video).mp3', ['music video'])] }]),
|
||||
page(0, 3, [{ directory: MAMMALZ, tracks: [track('Strobeline', 'a (Official Video).mp3', ['music video'])] }]),
|
||||
page(1, 3, [
|
||||
{ directory: HUMANZ, tracks: [track('Momentz', 'b (Visualizer).mp3', ['visualiser'])] },
|
||||
{ directory: '/music/Daft Punk/RAM', tracks: [track('Doin It Right', 'c (Music Video).mp3', ['music video'])] }
|
||||
{ directory: MAMMALZ, tracks: [track('Minutez', 'b (Visualizer).mp3', ['visualiser'])] },
|
||||
{ directory: '/music/Deft Monks/RAD', tracks: [track('Doin It Twice', 'c (Music Video).mp3', ['music video'])] }
|
||||
])
|
||||
])
|
||||
);
|
||||
render(SuspectSourcesPage);
|
||||
|
||||
expect(screen.getAllByText(HUMANZ)).toHaveLength(1);
|
||||
expect(screen.getAllByText(MAMMALZ)).toHaveLength(1);
|
||||
expect(screen.getAllByText('2 tracks')).toHaveLength(1);
|
||||
expect(screen.getAllByTestId('suspect-track-row')).toHaveLength(3);
|
||||
});
|
||||
@@ -107,7 +107,7 @@ describe('Suspect sources page', () => {
|
||||
|
||||
test('loads more as you scroll, with no button', () => {
|
||||
mocked.mockReturnValue(
|
||||
infinite([page(0, 80, [{ directory: HUMANZ, tracks: [track('Strobelite', 'a (Official Video).mp3', ['music video'])] }])], {
|
||||
infinite([page(0, 80, [{ directory: MAMMALZ, tracks: [track('Strobeline', 'a (Official Video).mp3', ['music video'])] }])], {
|
||||
hasNextPage: true
|
||||
})
|
||||
);
|
||||
@@ -123,8 +123,8 @@ describe('Suspect sources page', () => {
|
||||
infinite([
|
||||
page(0, 1, [
|
||||
{
|
||||
directory: HUMANZ,
|
||||
tracks: [track('Strobelite', 'Gorillaz - Strobelite (Official Video).mp3', ['music video'])]
|
||||
directory: MAMMALZ,
|
||||
tracks: [track('Strobeline', 'Plastic Apes - Strobeline (Official Video).mp3', ['music video'])]
|
||||
}
|
||||
])
|
||||
])
|
||||
@@ -133,7 +133,7 @@ describe('Suspect sources page', () => {
|
||||
expect(screen.getByTestId('suspect-verdict')).toHaveTextContent(/Held back/);
|
||||
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'This one is fine' }));
|
||||
expect(setSuspectVerdict).toHaveBeenCalledWith('t-Strobelite', 'fine');
|
||||
expect(setSuspectVerdict).toHaveBeenCalledWith('t-Strobeline', 'fine');
|
||||
expect(await screen.findByText('Marked fine')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Hold back again' })).toBeInTheDocument();
|
||||
});
|
||||
@@ -145,17 +145,17 @@ describe('Suspect sources page', () => {
|
||||
infinite([
|
||||
page(0, 1, [
|
||||
{
|
||||
directory: HUMANZ,
|
||||
tracks: [track('Strobelite', 'Gorillaz - Strobelite (Official Video).mp3', ['music video'])]
|
||||
directory: MAMMALZ,
|
||||
tracks: [track('Strobeline', 'Plastic Apes - Strobeline (Official Video).mp3', ['music video'])]
|
||||
}
|
||||
])
|
||||
])
|
||||
);
|
||||
render(SuspectSourcesPage);
|
||||
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Remove the file of Strobelite' }));
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Remove the file of Strobeline' }));
|
||||
expect(removeSuspectFile).not.toHaveBeenCalled();
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Confirm remove the file of Strobelite' }));
|
||||
expect(removeSuspectFile).toHaveBeenCalledWith('t-Strobelite');
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Confirm remove the file of Strobeline' }));
|
||||
expect(removeSuspectFile).toHaveBeenCalledWith('t-Strobeline');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user