Files
SpotiFLAC-Mobile/test/artist_utils_test.dart
T
zarzet 4eef5542be fix(metadata): recognize featured artist credits consistently
Handle feature and featured separators across display, Android finalization and Rust tag writing. Split conjunction credits only when separate artist IDs confirm them, and offer a picker for multi-artist navigation.
2026-10-02 18:10:00 +07:00

42 lines
1.4 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:spotiflac_android/utils/artist_utils.dart';
void main() {
test('featured variants and confirmed conjunction credits are clickable', () {
expect(splitArtistNames('One featured Two'), ['One', 'Two']);
expect(splitArtistNames('One feature Two'), ['One', 'Two']);
expect(primaryArtistTagValue('One featured Two'), 'One');
expect(primaryArtistTagValue('One feature Two'), 'One');
expect(splitArtistNames('One and Two', creditedArtistCount: 2), [
'One',
'Two',
]);
expect(splitArtistNames('Florence and the Machine'), [
'Florence and the Machine',
]);
expect(
splitArtistNames('Florence and the Machine', creditedArtistCount: 1),
['Florence and the Machine'],
);
});
test('primary artist prefers the first album artist', () {
expect(
primaryArtistName(
'Track Artist, Guest Artist',
albumArtist: 'Album Artist & Collaborator',
),
'Album Artist',
);
});
test('primary artist handles provider separator variants', () {
expect(primaryArtistName('One; Two & Three'), 'One');
expect(primaryArtistName('One feat. Two'), 'One');
expect(primaryArtistName('AC/DC'), 'AC/DC');
expect(
primaryArtistName('Actual Artist, Guest', albumArtist: 'Various Artists'),
'Actual Artist',
);
});
}