···2727 data: ListenResponse
2828 expected: ExpectedResults
2929}
3030-describe('Listenbrainz Listen Parsing', function () {
3030+describe('#PlayParse Listenbrainz Listen Parsing', function () {
31313232 describe('When user-submitted artist/track do NOT match MB mappings', function() {
3333 it('Uses user submitted values when no artist mappings', async function () {
···5656 })
575758585959- describe('When user-submitted artist/track matches a MB mapped value', function() {
5959+ describe('#PlayParse When user-submitted artist/track matches a MB mapped value', function() {
60606161 it('Detects slightly different track names as equal', async function () {
6262 for(const test of slightlyDifferentNames as unknown as LZTestFixture[]) {
+33-7
src/backend/tests/plays/playParsing.test.ts
···66import { asPlays, generateArtistsStr, generatePlay, normalizePlays } from "../utils/PlayTestUtils.js";
77import { parseArtistCredits, parseContextAwareStringList, parseCredits } from "../../utils/StringUtils.js";
8899-describe('Parsing Artists from String', function() {
99+describe('#PlayParse Parsing Artists from String', function() {
10101111 it('Parses Artists from an Artist-like string', function () {
1212- for(const i of Array(20)) {
1313- const [str, primaries, secondaries] = generateArtistsStr();
1212+ for(const i of Array(40)) {
1313+ const [str, primaries, secondaries] = generateArtistsStr({primary: {max: 3, ambiguousJoinedNames: true, trailingAmpersand: true, finalJoiner: false}});
1414 const credits = parseArtistCredits(str);
1515 const allArtists = primaries.concat(secondaries);
1616- const parsed = [credits.primary].concat(credits.secondary ?? [])
1616+ const parsed = [credits.primary].concat(credits.secondary ?? []);
1717 expect(primaries.concat(secondaries),`
1818'${str}'
1919Expected => ${allArtists.join(' || ')}
···25252626 it('Parses & as "local" joiner when other delimiters present', function () {
27272828- const data = [{
2828+ const data = [
2929+ {
2930 str: `Melendi \\ Ryan Lewis \\ The Righteous Brothers (featuring Joan Jett & The Blackhearts \\ Robin Schulz)`,
3031 expected: ['Melendi', 'Ryan Lewis', 'The Righteous Brothers', 'Joan Jett & The Blackhearts', 'Robin Schulz']
3131- }, {
3232+ },
3333+ {
3234 str: `Gigi D'Agostino \\ YOASOBI (vs Sam Hunt, Lisa Loeb & Booba)`,
3335 expected: [`Gigi D'Agostino`, 'YOASOBI', 'Sam Hunt', 'Lisa Loeb', 'Booba']
3434- }];
3636+ },
3737+ {
3838+ str: `Wham!, Hillsong Worship & Bruce Channel feat. I Prevail`,
3939+ expected: ['Wham!', 'Hillsong Worship & Bruce Channel', 'I Prevail']
4040+ }
4141+ ];
35423643 for(const d of data) {
3744 const credits = parseArtistCredits(d.str);
···4754 str: `Melendi & Ryan Lewis & The Righteous Brothers (featuring The Blackhearts \\ Robin Schulz)`,
4855 expected: ['Melendi', 'Ryan Lewis', 'The Righteous Brothers', 'The Blackhearts', 'Robin Schulz']
4956 }];
5757+5858+ for(const d of data) {
5959+ const credits = parseArtistCredits(d.str);
6060+ const parsed = [credits.primary].concat(credits.secondary ?? [])
6161+ expect(d.expected).eql(parsed)
6262+ }
6363+ });
6464+6565+ it('Does not split artist name when only one joiner is present', function () {
6666+6767+ const data = [
6868+ {
6969+ str: `Melendi & Ryan Lewis`,
7070+ expected: ['Melendi & Ryan Lewis']
7171+ },{
7272+ str: `Melendi and Ryan Lewis`,
7373+ expected: ['Melendi and Ryan Lewis']
7474+ },
7575+ ];
50765177 for(const d of data) {
5278 const credits = parseArtistCredits(d.str);