diff options
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/content/dependencies/linkContribution.js | 54 | ||||
-rw-r--r-- | test/unit/data/things/album.js | 4 | ||||
-rw-r--r-- | test/unit/data/things/art-tag.js | 4 | ||||
-rw-r--r-- | test/unit/data/things/track.js | 42 | ||||
-rw-r--r-- | test/unit/data/things/validators.js | 14 |
5 files changed, 59 insertions, 59 deletions
diff --git a/test/unit/content/dependencies/linkContribution.js b/test/unit/content/dependencies/linkContribution.js index 94908901..ab45b03a 100644 --- a/test/unit/content/dependencies/linkContribution.js +++ b/test/unit/content/dependencies/linkContribution.js @@ -2,27 +2,27 @@ import t from 'tap'; import {testContentFunctions} from '#test-lib'; t.test('generateContributionLinks (unit)', async t => { - const who1 = { + const artist1 = { name: 'Clark Powell', directory: 'clark-powell', urls: ['https://soundcloud.com/plazmataz'], }; - const who2 = { + const artist2 = { name: 'Grounder & Scratch', directory: 'the-big-baddies', urls: [], }; - const who3 = { + const artist3 = { name: 'Toby Fox', directory: 'toby-fox', urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'], }; - const what1 = null; - const what2 = 'Snooping'; - const what3 = 'Arrangement'; + const annotation1 = null; + const annotation2 = 'Snooping'; + const annotation3 = 'Arrangement'; await testContentFunctions(t, 'generateContributionLinks (unit 1)', async (t, evaluate) => { const slots = { @@ -34,14 +34,14 @@ t.test('generateContributionLinks (unit)', async t => { mock: evaluate.mock(mock => ({ linkArtist: { relations: mock.function('linkArtist.relations', () => ({})) - .args([undefined, who1]).next() - .args([undefined, who2]).next() - .args([undefined, who3]), + .args([undefined, artist1]).next() + .args([undefined, artist2]).next() + .args([undefined, artist3]), data: mock.function('linkArtist.data', () => ({})) - .args([who1]).next() - .args([who2]).next() - .args([who3]), + .args([artist1]).next() + .args([artist2]).next() + .args([artist3]), // This can be tweaked to return a specific (mocked) template // for each artist if we need to test for slots in the future. @@ -51,9 +51,9 @@ t.test('generateContributionLinks (unit)', async t => { linkExternalAsIcon: { data: mock.function('linkExternalAsIcon.data', () => ({})) - .args([who1.urls[0]]).next() - .args([who3.urls[0]]).next() - .args([who3.urls[1]]), + .args([artist1.urls[0]]).next() + .args([artist3.urls[0]]).next() + .args([artist3.urls[1]]), generate: mock.function('linkExternalAsIcon.generate', () => 'icon') .repeat(3), @@ -64,9 +64,9 @@ t.test('generateContributionLinks (unit)', async t => { evaluate({ name: 'linkContribution', multiple: [ - {args: [{who: who1, what: what1}]}, - {args: [{who: who2, what: what2}]}, - {args: [{who: who3, what: what3}]}, + {args: [{artist: artist1, annotation: annotation1}]}, + {args: [{artist: artist2, annotation: annotation2}]}, + {args: [{artist: artist3, annotation: annotation3}]}, ], slots, }); @@ -82,14 +82,14 @@ t.test('generateContributionLinks (unit)', async t => { mock: evaluate.mock(mock => ({ linkArtist: { relations: mock.function('linkArtist.relations', () => ({})) - .args([undefined, who1]).next() - .args([undefined, who2]).next() - .args([undefined, who3]), + .args([undefined, artist1]).next() + .args([undefined, artist2]).next() + .args([undefined, artist3]), data: mock.function('linkArtist.data', () => ({})) - .args([who1]).next() - .args([who2]).next() - .args([who3]), + .args([artist1]).next() + .args([artist2]).next() + .args([artist3]), generate: mock.function(() => 'artist link') .repeat(3), @@ -112,9 +112,9 @@ t.test('generateContributionLinks (unit)', async t => { evaluate({ name: 'linkContribution', multiple: [ - {args: [{who: who1, what: what1}]}, - {args: [{who: who2, what: what2}]}, - {args: [{who: who3, what: what3}]}, + {args: [{artist: artist1, annotation: annotation1}]}, + {args: [{artist: artist2, annotation: annotation2}]}, + {args: [{artist: artist3, annotation: annotation3}]}, ], slots, }); diff --git a/test/unit/data/things/album.js b/test/unit/data/things/album.js index 46ea83b0..bf9992ae 100644 --- a/test/unit/data/things/album.js +++ b/test/unit/data/things/album.js @@ -21,8 +21,8 @@ function stubArtistAndContribs() { const artist = new Artist(); artist.name = `Test Artist`; - const contribs = [{who: `Test Artist`, what: null}]; - const badContribs = [{who: `Figment of Your Imagination`, what: null}]; + const contribs = [{artist: `Test Artist`, annotation: null}]; + const badContribs = [{artist: `Figment of Your Imagination`, annotation: null}]; return {artist, contribs, badContribs}; } diff --git a/test/unit/data/things/art-tag.js b/test/unit/data/things/art-tag.js index 561c93ef..836bb1c3 100644 --- a/test/unit/data/things/art-tag.js +++ b/test/unit/data/things/art-tag.js @@ -43,8 +43,8 @@ function stubArtist(artistName = `Test Artist`) { function stubArtistAndContribs(artistName = `Test Artist`) { const artist = stubArtist(artistName); - const contribs = [{who: artistName, what: null}]; - const badContribs = [{who: `Figment of Your Imagination`, what: null}]; + const contribs = [{artist: artistName, annotation: null}]; + const badContribs = [{artist: `Figment of Your Imagination`, annotation: null}]; return {artist, contribs, badContribs}; } diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js index b1c1611e..57a297db 100644 --- a/test/unit/data/things/track.js +++ b/test/unit/data/things/track.js @@ -46,8 +46,8 @@ function stubArtist(artistName = `Test Artist`) { function stubArtistAndContribs(artistName = `Test Artist`) { const artist = stubArtist(artistName); - const contribs = [{who: artistName, what: null}]; - const badContribs = [{who: `Figment of Your Imagination`, what: null}]; + const contribs = [{artist: artistName, annotation: null}]; + const badContribs = [{artist: `Figment of Your Imagination`, annotation: null}]; return {artist, contribs, badContribs}; } @@ -189,31 +189,31 @@ t.test(`Track.artistContribs`, t => { `artistContribs #1: defaults to empty array`); album.artistContribs = [ - {who: `Artist 1`, what: `composition`}, - {who: `Artist 2`, what: null}, + {artist: `Artist 1`, annotation: `composition`}, + {artist: `Artist 2`, annotation: null}, ]; XXX_decacheWikiData(); t.same(track.artistContribs, - [{who: artist1, what: `composition`}, {who: artist2, what: null}], + [{artist: artist1, annotation: `composition`}, {artist: artist2, annotation: null}], `artistContribs #2: inherits album artistContribs`); track.artistContribs = [ - {who: `Artist 1`, what: `arrangement`}, + {artist: `Artist 1`, annotation: `arrangement`}, ]; - t.same(track.artistContribs, [{who: artist1, what: `arrangement`}], + t.same(track.artistContribs, [{artist: artist1, annotation: `arrangement`}], `artistContribs #3: resolves from own value`); track.artistContribs = [ - {who: `Artist 1`, what: `snooping`}, - {who: `Artist 413`, what: `as`}, - {who: `Artist 2`, what: `usual`}, + {artist: `Artist 1`, annotation: `snooping`}, + {artist: `Artist 413`, annotation: `as`}, + {artist: `Artist 2`, annotation: `usual`}, ]; t.same(track.artistContribs, - [{who: artist1, what: `snooping`}, {who: artist2, what: `usual`}], + [{artist: artist1, annotation: `snooping`}, {artist: artist2, annotation: `usual`}], `artistContribs #4: filters out names without matches`); }); @@ -303,7 +303,7 @@ t.test(`Track.commentatorArtists`, t => { `Track.commentatorArtists #2: works with two commentators`); track.commentary = commentary += - `<i>Icy|<b>Icy What You Did There</b>:</i>\n` + + `<i>Icy|<b>Icy annotation You Did There</b>:</i>\n` + `Incredible.\n`; t.same(track.commentatorArtists, [artist1, artist2, artist3], @@ -362,31 +362,31 @@ t.test(`Track.coverArtistContribs`, t => { `coverArtistContribs #1: defaults to empty array`); album.trackCoverArtistContribs = [ - {who: `Artist 1`, what: `lines`}, - {who: `Artist 2`, what: null}, + {artist: `Artist 1`, annotation: `lines`}, + {artist: `Artist 2`, annotation: null}, ]; XXX_decacheWikiData(); t.same(track.coverArtistContribs, - [{who: artist1, what: `lines`}, {who: artist2, what: null}], + [{artist: artist1, annotation: `lines`}, {artist: artist2, annotation: null}], `coverArtistContribs #2: inherits album trackCoverArtistContribs`); track.coverArtistContribs = [ - {who: `Artist 1`, what: `collage`}, + {artist: `Artist 1`, annotation: `collage`}, ]; - t.same(track.coverArtistContribs, [{who: artist1, what: `collage`}], + t.same(track.coverArtistContribs, [{artist: artist1, annotation: `collage`}], `coverArtistContribs #3: resolves from own value`); track.coverArtistContribs = [ - {who: `Artist 1`, what: `snooping`}, - {who: `Artist 413`, what: `as`}, - {who: `Artist 2`, what: `usual`}, + {artist: `Artist 1`, annotation: `snooping`}, + {artist: `Artist 413`, annotation: `as`}, + {artist: `Artist 2`, annotation: `usual`}, ]; t.same(track.coverArtistContribs, - [{who: artist1, what: `snooping`}, {who: artist2, what: `usual`}], + [{artist: artist1, annotation: `snooping`}, {artist: artist2, annotation: `usual`}], `coverArtistContribs #4: filters out names without matches`); track.disableUniqueCoverArt = true; diff --git a/test/unit/data/things/validators.js b/test/unit/data/things/validators.js index eeb2465e..3a217d6f 100644 --- a/test/unit/data/things/validators.js +++ b/test/unit/data/things/validators.js @@ -280,17 +280,17 @@ t.test('isContentString', t => { t.test('isContribution', t => { t.plan(4); - t.ok(isContribution({who: 'artist:toby-fox', what: 'Music'})); - t.ok(isContribution({who: 'Toby Fox'})); - t.throws(() => isContribution(({who: 'group:umspaf', what: 'Organizing'})), - {errors: /who/}); - t.throws(() => isContribution(({who: 'artist:toby-fox', what: 123})), - {errors: /what/}); + t.ok(isContribution({artist: 'artist:toby-fox', annotation: 'Music'})); + t.ok(isContribution({artist: 'Toby Fox'})); + t.throws(() => isContribution(({artist: 'group:umspaf', annotation: 'Organizing'})), + {errors: /artist/}); + t.throws(() => isContribution(({artist: 'artist:toby-fox', annotation: 123})), + {errors: /annotation/}); }); t.test('isContributionList', t => { t.plan(4); - t.ok(isContributionList([{who: 'Beavis'}, {who: 'Butthead', what: 'Wrangling'}])); + t.ok(isContributionList([{artist: 'Beavis'}, {artist: 'Butthead', annotation: 'Wrangling'}])); t.ok(isContributionList([])); t.throws(() => isContributionList(2)); t.throws(() => isContributionList(['Charlie', 'Woodstock'])); |