diff options
Diffstat (limited to 'test/snapshot')
-rw-r--r-- | test/snapshot/generateAdditionalFilesList.js | 64 | ||||
-rw-r--r-- | test/snapshot/generateAdditionalFilesShortcut.js | 36 | ||||
-rw-r--r-- | test/snapshot/generateAlbumCoverArtwork.js | 36 | ||||
-rw-r--r-- | test/snapshot/generateAlbumReleaseInfo.js | 14 | ||||
-rw-r--r-- | test/snapshot/generateAlbumSecondaryNav.js | 47 | ||||
-rw-r--r-- | test/snapshot/generateAlbumSidebarGroupBox.js | 2 | ||||
-rw-r--r-- | test/snapshot/generateAlbumTrackList.js | 25 | ||||
-rw-r--r-- | test/snapshot/generateCoverArtwork.js | 31 | ||||
-rw-r--r-- | test/snapshot/generatePreviousNextLinks.js | 35 | ||||
-rw-r--r-- | test/snapshot/generateTrackAdditionalNamesBox.js | 107 | ||||
-rw-r--r-- | test/snapshot/generateTrackCoverArtwork.js | 61 | ||||
-rw-r--r-- | test/snapshot/generateTrackReleaseInfo.js | 4 | ||||
-rw-r--r-- | test/snapshot/image.js | 13 | ||||
-rw-r--r-- | test/snapshot/linkContribution.js | 69 | ||||
-rw-r--r-- | test/snapshot/linkExternal.js | 171 | ||||
-rw-r--r-- | test/snapshot/linkThing.js | 2 | ||||
-rw-r--r-- | test/snapshot/transformContent.js | 10 |
17 files changed, 269 insertions, 458 deletions
diff --git a/test/snapshot/generateAdditionalFilesList.js b/test/snapshot/generateAdditionalFilesList.js deleted file mode 100644 index 3ea1c37e..00000000 --- a/test/snapshot/generateAdditionalFilesList.js +++ /dev/null @@ -1,64 +0,0 @@ -import t from 'tap'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generateAdditionalFilesList (snapshot)', async (t, evaluate) => { - await evaluate.load(); - - evaluate.snapshot('no additional files', { - name: 'generateAdditionalFilesList', - args: [[]], - }); - - evaluate.snapshot('basic behavior', { - name: 'generateAdditionalFilesList', - args: [ - [ - { - title: 'SBURB Wallpaper', - files: [ - 'sburbwp_1280x1024.jpg', - 'sburbwp_1440x900.jpg', - 'sburbwp_1920x1080.jpg', - ], - }, - { - title: 'Fake Section', - description: 'Ooo, what happens if there are NO file links provided?', - files: [ - 'oops.mp3', - 'Internet Explorer.gif', - 'daisy.mp3', - ], - }, - { - title: 'Alternate Covers', - description: 'This is just an example description.', - files: [ - 'Homestuck_Vol4_alt1.jpg', - 'Homestuck_Vol4_alt2.jpg', - 'Homestuck_Vol4_alt3.jpg', - ], - }, - ], - ], - slots: { - fileLinks: { - 'sburbwp_1280x1024.jpg': 'link to 1280x1024', - 'sburbwp_1440x900.jpg': 'link to 1440x900', - 'sburbwp_1920x1080.jpg': null, - 'Homestuck_Vol4_alt1.jpg': 'link to alt1', - 'Homestuck_Vol4_alt2.jpg': null, - 'Homestuck_Vol4_alt3.jpg': 'link to alt3', - }, - fileSizes: { - 'sburbwp_1280x1024.jpg': 2500, - 'sburbwp_1440x900.jpg': null, - 'sburbwp_1920x1080.jpg': null, - 'Internet Explorer.gif': 1, - 'Homestuck_Vol4_alt1.jpg': 1234567, - 'Homestuck_Vol4_alt2.jpg': 1234567, - 'Homestuck_Vol4_alt3.jpg': 1234567, - } - }, - }); -}); diff --git a/test/snapshot/generateAdditionalFilesShortcut.js b/test/snapshot/generateAdditionalFilesShortcut.js deleted file mode 100644 index 9825efa1..00000000 --- a/test/snapshot/generateAdditionalFilesShortcut.js +++ /dev/null @@ -1,36 +0,0 @@ -import t from 'tap'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generateAdditionalFilesShortcut (snapshot)', async (t, evaluate) => { - await evaluate.load(); - - evaluate.snapshot('no additional files', { - name: 'generateAdditionalFilesShortcut', - args: [[]], - }); - - evaluate.snapshot('basic behavior', { - name: 'generateAdditionalFilesShortcut', - args: [ - [ - { - title: 'SBURB Wallpaper', - files: [ - 'sburbwp_1280x1024.jpg', - 'sburbwp_1440x900.jpg', - 'sburbwp_1920x1080.jpg', - ], - }, - { - title: 'Alternate Covers', - description: 'This is just an example description.', - files: [ - 'Homestuck_Vol4_alt1.jpg', - 'Homestuck_Vol4_alt2.jpg', - 'Homestuck_Vol4_alt3.jpg', - ], - }, - ], - ], - }); -}); diff --git a/test/snapshot/generateAlbumCoverArtwork.js b/test/snapshot/generateAlbumCoverArtwork.js deleted file mode 100644 index 9244c034..00000000 --- a/test/snapshot/generateAlbumCoverArtwork.js +++ /dev/null @@ -1,36 +0,0 @@ -import t from 'tap'; - -import contentFunction from '#content-function'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generateAlbumCoverArtwork (snapshot)', async (t, evaluate) => { - await evaluate.load({ - mock: { - image: evaluate.stubContentFunction('image'), - }, - }); - - const album = { - directory: 'bee-forus-seatbelt-safebee', - coverArtFileExtension: 'png', - color: '#f28514', - artTags: [ - {name: 'Damara', directory: 'damara', isContentWarning: false}, - {name: 'Cronus', directory: 'cronus', isContentWarning: false}, - {name: 'Bees', directory: 'bees', isContentWarning: false}, - {name: 'creepy crawlies', isContentWarning: true}, - ], - }; - - evaluate.snapshot('display: primary', { - name: 'generateAlbumCoverArtwork', - args: [album], - slots: {mode: 'primary'}, - }); - - evaluate.snapshot('display: thumbnail', { - name: 'generateAlbumCoverArtwork', - args: [album], - slots: {mode: 'thumbnail'}, - }); -}); diff --git a/test/snapshot/generateAlbumReleaseInfo.js b/test/snapshot/generateAlbumReleaseInfo.js index 3dea1196..f41e502d 100644 --- a/test/snapshot/generateAlbumReleaseInfo.js +++ b/test/snapshot/generateAlbumReleaseInfo.js @@ -8,22 +8,22 @@ testContentFunctions(t, 'generateAlbumReleaseInfo (snapshot)', async (t, evaluat name: 'generateAlbumReleaseInfo', args: [{ artistContribs: [ - {who: {name: 'Toby Fox', directory: 'toby-fox', urls: null}, what: 'music probably'}, - {who: {name: 'Tensei', directory: 'tensei', urls: ['https://tenseimusic.bandcamp.com/']}, what: 'hot jams'}, + {artist: {name: 'Toby Fox', directory: 'toby-fox', urls: []}, annotation: 'music probably'}, + {artist: {name: 'Tensei', directory: 'tensei', urls: ['https://tenseimusic.bandcamp.com/']}, annotation: 'hot jams'}, ], coverArtistContribs: [ - {who: {name: 'Hanni Brosh', directory: 'hb', urls: null}, what: null}, + {artist: {name: 'Hanni Brosh', directory: 'hb', urls: []}, annotation: null}, ], wallpaperArtistContribs: [ - {who: {name: 'Hanni Brosh', directory: 'hb', urls: null}, what: null}, - {who: {name: 'Niklink', directory: 'niklink', urls: null}, what: 'edits'}, + {artist: {name: 'Hanni Brosh', directory: 'hb', urls: []}, annotation: null}, + {artist: {name: 'Niklink', directory: 'niklink', urls: []}, annotation: 'edits'}, ], bannerArtistContribs: [ - {who: {name: 'Hanni Brosh', directory: 'hb', urls: null}, what: null}, - {who: {name: 'Niklink', directory: 'niklink', urls: null}, what: 'edits'}, + {artist: {name: 'Hanni Brosh', directory: 'hb', urls: []}, annotation: null}, + {artist: {name: 'Niklink', directory: 'niklink', urls: []}, annotation: 'edits'}, ], name: 'AlterniaBound', diff --git a/test/snapshot/generateAlbumSecondaryNav.js b/test/snapshot/generateAlbumSecondaryNav.js index 709b062e..2495bc4a 100644 --- a/test/snapshot/generateAlbumSecondaryNav.js +++ b/test/snapshot/generateAlbumSecondaryNav.js @@ -4,25 +4,60 @@ import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumSecondaryNav (snapshot)', async (t, evaluate) => { await evaluate.load(); - let album, group1, group2; + let album, anotherAlbum, group1, group2; - group1 = {name: 'VCG', directory: 'vcg', color: '#abcdef'}; - group2 = {name: 'Bepis', directory: 'bepis', color: '#123456'}; + group1 = { + name: 'VCG', + directory: 'vcg', + color: '#abcdef', + serieses: [], + }; + + group2 = { + name: 'Bepis', + directory: 'bepis', + color: '#123456', + serieses: [], + }; album = { + name: 'Album', + directory: 'album', date: new Date('2010-04-13'), groups: [group1, group2], }; + anotherAlbum = { + name: 'Last', + directory: 'last', + date: new Date('2010-06-12'), + }; + group1.albums = [ - {name: 'First', directory: 'first', date: new Date('2010-04-10')}, + { + name: 'First', + directory: 'first', + date: new Date('2010-04-10'), + }, album, - {name: 'Last', directory: 'last', date: new Date('2010-06-12')}, + anotherAlbum, + ]; + + group1.serieses = [ + { + name: 'Series', + albums: [album, anotherAlbum], + group: group1, + }, ]; group2.albums = [ album, - {name: 'Second', directory: 'second', date: new Date('2011-04-13')}, + { + name: 'Second', + directory: 'second', + date: new Date('2011-04-13'), + }, ]; evaluate.snapshot('basic behavior, mode: album', { diff --git a/test/snapshot/generateAlbumSidebarGroupBox.js b/test/snapshot/generateAlbumSidebarGroupBox.js index 87850510..f920bd96 100644 --- a/test/snapshot/generateAlbumSidebarGroupBox.js +++ b/test/snapshot/generateAlbumSidebarGroupBox.js @@ -11,6 +11,8 @@ testContentFunctions(t, 'generateAlbumSidebarGroupBox (snapshot)', async (t, eva let album, group; album = { + name: 'Middle', + directory: 'middle', date: new Date('2010-04-13'), }; diff --git a/test/snapshot/generateAlbumTrackList.js b/test/snapshot/generateAlbumTrackList.js index 181cc1d2..e09f1c4a 100644 --- a/test/snapshot/generateAlbumTrackList.js +++ b/test/snapshot/generateAlbumTrackList.js @@ -6,16 +6,20 @@ testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) mock: { generateAlbumTrackListMissingDuration: evaluate.stubContentFunction('generateAlbumTrackListMissingDuration'), + + image: + evaluate.stubContentFunction('image'), }, }); const contribs1 = [ - {who: {name: 'Apricot', directory: 'apricot', urls: null}}, + {artist: {name: 'Apricot', directory: 'apricot', urls: []}}, ]; const contribs2 = [ - {who: {name: 'Apricot', directory: 'apricot', urls: null}}, - {who: {name: 'Peach', directory: 'peach', urls: ['https://peach.bandcamp.com/']}}, + {artist: {name: 'Apricot', directory: 'apricot', urls: []}}, + {artist: {name: 'Peach', directory: 'peach', urls: ['https://peach.bandcamp.com/']}}, + {artist: {name: 'Cerise', directory: 'cerise', urls: []}}, ]; const color1 = '#fb07ff'; @@ -45,6 +49,16 @@ testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) tracks, }; + const albumWithTrackSectionDescriptions = { + color: color1, + artistContribs: contribs1, + trackSections: [ + {name: 'First section', tracks: tracks.slice(0, 3), description: `Why yes!`}, + {name: 'Second section', tracks: tracks.slice(3), description: `How *contentful,* this is.`}, + ], + tracks, + }; + const albumWithNoDuration = { color: color1, artistContribs: contribs1, @@ -62,6 +76,11 @@ testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) args: [albumWithoutTrackSections], }); + evaluate.snapshot(`basic behavior, with descriptions`, { + name: 'generateAlbumTrackList', + args: [albumWithTrackSectionDescriptions], + }); + evaluate.snapshot(`collapseDurationScope: never`, { name: 'generateAlbumTrackList', slots: {collapseDurationScope: 'never'}, diff --git a/test/snapshot/generateCoverArtwork.js b/test/snapshot/generateCoverArtwork.js deleted file mode 100644 index e35dd8d0..00000000 --- a/test/snapshot/generateCoverArtwork.js +++ /dev/null @@ -1,31 +0,0 @@ -import t from 'tap'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generateCoverArtwork (snapshot)', async (t, evaluate) => { - await evaluate.load({ - mock: { - image: evaluate.stubContentFunction('image', {mock: true}), - }, - }); - - const artTags = [ - {name: 'Damara', directory: 'damara', isContentWarning: false}, - {name: 'Cronus', directory: 'cronus', isContentWarning: false}, - {name: 'Bees', directory: 'bees', isContentWarning: false}, - {name: 'creepy crawlies', isContentWarning: true}, - ]; - - const path = ['media.albumCover', 'bee-forus-seatbelt-safebee', 'png']; - - evaluate.snapshot('display: primary', { - name: 'generateCoverArtwork', - args: [artTags], - slots: {path, mode: 'primary'}, - }); - - evaluate.snapshot('display: thumbnail', { - name: 'generateCoverArtwork', - args: [artTags], - slots: {path, mode: 'thumbnail'}, - }); -}); diff --git a/test/snapshot/generatePreviousNextLinks.js b/test/snapshot/generatePreviousNextLinks.js deleted file mode 100644 index 0d952f59..00000000 --- a/test/snapshot/generatePreviousNextLinks.js +++ /dev/null @@ -1,35 +0,0 @@ -import t from 'tap'; -import * as html from '#html'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generatePreviousNextLinks (snapshot)', async (t, evaluate) => { - await evaluate.load(); - - const quickSnapshot = (message, slots) => - evaluate.snapshot(message, { - name: 'generatePreviousNextLinks', - slots, - postprocess: template => template.content.join('\n'), - }); - - quickSnapshot('basic behavior', { - previousLink: evaluate.stubTemplate('previous'), - nextLink: evaluate.stubTemplate('next'), - }); - - quickSnapshot('previous missing', { - nextLink: evaluate.stubTemplate('next'), - }); - - quickSnapshot('next missing', { - previousLink: evaluate.stubTemplate('previous'), - }); - - quickSnapshot('neither link present', {}); - - quickSnapshot('disable id', { - previousLink: evaluate.stubTemplate('previous'), - nextLink: evaluate.stubTemplate('next'), - id: false, - }); -}); diff --git a/test/snapshot/generateTrackAdditionalNamesBox.js b/test/snapshot/generateTrackAdditionalNamesBox.js deleted file mode 100644 index 9c1e3598..00000000 --- a/test/snapshot/generateTrackAdditionalNamesBox.js +++ /dev/null @@ -1,107 +0,0 @@ -import t from 'tap'; - -import contentFunction from '#content-function'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generateTrackAdditionalNamesBox (snapshot)', async (t, evaluate) => { - await evaluate.load({ - mock: { - generateAdditionalNamesBox: - evaluate.stubContentFunction('generateAdditionalNamesBox'), - }, - }); - - const stubTrack = { - additionalNames: [], - sharedAdditionalNames: [], - inferredAdditionalNames: [], - }; - - const quickSnapshot = (message, trackProperties) => - evaluate.snapshot(message, { - name: 'generateTrackAdditionalNamesBox', - args: [{...stubTrack, ...trackProperties}], - }); - - quickSnapshot(`no additional names`, {}); - - quickSnapshot(`own additional names only`, { - additionalNames: [ - {name: `Foo Bar`, annotation: `the Alps`}, - ], - }); - - quickSnapshot(`shared additional names only`, { - sharedAdditionalNames: [ - {name: `Bar Foo`, annotation: `the Rockies`}, - ], - }); - - quickSnapshot(`inferred additional names only`, { - inferredAdditionalNames: [ - {name: `Baz Baz`, from: [{directory: `the-pyrenees`}]}, - ], - }); - - quickSnapshot(`multiple own`, { - additionalNames: [ - {name: `Apple Time!`}, - {name: `Pterodactyl Time!`}, - {name: `Banana Time!`}, - ], - }); - - quickSnapshot(`own and shared, some overlap`, { - additionalNames: [ - {name: `weed dreams..`, annotation: `own annotation`}, - {name: `夜間のMOON汗`, annotation: `own annotation`}, - ], - sharedAdditionalNames: [ - {name: `weed dreams..`, annotation: `shared annotation`}, - {name: `GAMINGブラザー96`, annotation: `shared annotation`}, - ], - }); - - quickSnapshot(`shared and inferred, some overlap`, { - sharedAdditionalNames: [ - {name: `Coruscate`, annotation: `shared annotation`}, - {name: `Arbroath`, annotation: `shared annotation`}, - ], - inferredAdditionalNames: [ - {name: `Arbroath`, from: [{directory: `inferred-from`}]}, - {name: `Prana Ferox`, from: [{directory: `inferred-from`}]}, - ], - }); - - quickSnapshot(`own and inferred, some overlap`, { - additionalNames: [ - {name: `Ke$halo Strike Back`, annotation: `own annotation`}, - {name: `Ironic Mania`, annotation: `own annotation`}, - ], - inferredAdditionalNames: [ - {name: `Ironic Mania`, from: [{directory: `inferred-from`}]}, - {name: `ANARCHY::MEGASTRIFE`, from: [{directory: `inferred-from`}]}, - ], - }); - - quickSnapshot(`own and shared and inferred, various overlap`, { - additionalNames: [ - {name: `Own!`, annotation: `own annotation`}, - {name: `Own! Shared!`, annotation: `own annotation`}, - {name: `Own! Inferred!`, annotation: `own annotation`}, - {name: `Own! Shared! Inferred!`, annotation: `own annotation`}, - ], - sharedAdditionalNames: [ - {name: `Shared!`, annotation: `shared annotation`}, - {name: `Own! Shared!`, annotation: `shared annotation`}, - {name: `Shared! Inferred!`, annotation: `shared annotation`}, - {name: `Own! Shared! Inferred!`, annotation: `shared annotation`}, - ], - inferredAdditionalNames: [ - {name: `Inferred!`, from: [{directory: `inferred-from`}]}, - {name: `Own! Inferred!`, from: [{directory: `inferred-from`}]}, - {name: `Shared! Inferred!`, from: [{directory: `inferred-from`}]}, - {name: `Own! Shared! Inferred!`, from: [{directory: `inferred-from`}]}, - ], - }); -}); diff --git a/test/snapshot/generateTrackCoverArtwork.js b/test/snapshot/generateTrackCoverArtwork.js deleted file mode 100644 index 1e651eb1..00000000 --- a/test/snapshot/generateTrackCoverArtwork.js +++ /dev/null @@ -1,61 +0,0 @@ -import t from 'tap'; -import {testContentFunctions} from '#test-lib'; - -testContentFunctions(t, 'generateTrackCoverArtwork (snapshot)', async (t, evaluate) => { - await evaluate.load({ - mock: { - image: evaluate.stubContentFunction('image'), - }, - }); - - const album = { - directory: 'bee-forus-seatbelt-safebee', - coverArtFileExtension: 'png', - artTags: [ - {name: 'Damara', directory: 'damara', isContentWarning: false}, - {name: 'Cronus', directory: 'cronus', isContentWarning: false}, - {name: 'Bees', directory: 'bees', isContentWarning: false}, - {name: 'creepy crawlies', isContentWarning: true}, - ], - }; - - const track1 = { - directory: 'beesmp3', - hasUniqueCoverArt: true, - coverArtFileExtension: 'jpg', - color: '#f28514', - artTags: [{name: 'Bees', directory: 'bees', isContentWarning: false}], - album, - }; - - const track2 = { - directory: 'fake-bonus-track', - hasUniqueCoverArt: false, - color: '#abcdef', - album, - }; - - evaluate.snapshot('display: primary - unique art', { - name: 'generateTrackCoverArtwork', - args: [track1], - slots: {mode: 'primary'}, - }); - - evaluate.snapshot('display: thumbnail - unique art', { - name: 'generateTrackCoverArtwork', - args: [track1], - slots: {mode: 'thumbnail'}, - }); - - evaluate.snapshot('display: primary - no unique art', { - name: 'generateTrackCoverArtwork', - args: [track2], - slots: {mode: 'primary'}, - }); - - evaluate.snapshot('display: thumbnail - no unique art', { - name: 'generateTrackCoverArtwork', - args: [track2], - slots: {mode: 'thumbnail'}, - }); -}); diff --git a/test/snapshot/generateTrackReleaseInfo.js b/test/snapshot/generateTrackReleaseInfo.js index c72344b9..931377c8 100644 --- a/test/snapshot/generateTrackReleaseInfo.js +++ b/test/snapshot/generateTrackReleaseInfo.js @@ -4,8 +4,8 @@ import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateTrackReleaseInfo (snapshot)', async (t, evaluate) => { await evaluate.load(); - const artistContribs = [{who: {name: 'Toby Fox', directory: 'toby-fox', urls: null}, what: null}]; - const coverArtistContribs = [{who: {name: 'Alpaca', directory: 'alpaca', urls: null}, what: '🔥'}]; + const artistContribs = [{artist: {name: 'Toby Fox', directory: 'toby-fox', urls: []}, annotation: null}]; + const coverArtistContribs = [{artist: {name: 'Alpaca', directory: 'alpaca', urls: []}, annotation: '🔥'}]; evaluate.snapshot('basic behavior', { name: 'generateTrackReleaseInfo', diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 447e7fa7..1985211f 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -38,11 +38,10 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { }, }); - quickSnapshot('width & height', { + quickSnapshot('dimensions', { slots: { src: 'foobar', - width: 600, - height: 400, + dimensions: [600, 400], }, }); @@ -53,6 +52,14 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { }, }); + quickSnapshot('dimensions with square', { + slots: { + src: 'foobar', + dimensions: [600, 400], + square: true, + }, + }); + quickSnapshot('lazy with square', { slots: { src: 'foobar', diff --git a/test/snapshot/linkContribution.js b/test/snapshot/linkContribution.js index ebd3be58..47ef1503 100644 --- a/test/snapshot/linkContribution.js +++ b/test/snapshot/linkContribution.js @@ -9,80 +9,49 @@ testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => { name: 'linkContribution', multiple: [ {args: [ - {who: { + {artist: { name: 'Clark Powell', directory: 'clark-powell', urls: ['https://soundcloud.com/plazmataz'], - }, what: null}, + }, annotation: null}, ]}, {args: [ - {who: { + {artist: { name: 'Grounder & Scratch', directory: 'the-big-baddies', urls: [], - }, what: 'Snooping'}, + }, annotation: 'Snooping'}, ]}, {args: [ - {who: { + {artist: { name: 'Toby Fox', directory: 'toby-fox', urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'], - }, what: 'Arrangement'}, + }, annotation: 'Arrangement'}, ]}, ], slots, }); - quickSnapshot('showContribution & showIcons (inline)', { - showContribution: true, - showIcons: true, - iconMode: 'inline', + quickSnapshot('showAnnotation & showExternalLinks', { + showAnnotation: true, + showExternalLinks: true, }); - quickSnapshot('showContribution & showIcons (tooltip)', { - showContribution: true, - showIcons: true, - iconMode: 'tooltip', + quickSnapshot('only showAnnotation', { + showAnnotation: true, }); - quickSnapshot('only showContribution', { - showContribution: true, - }); - - quickSnapshot('only showIcons (inline)', { - showIcons: true, - iconMode: 'inline', - }); - - quickSnapshot('only showIcons (tooltip)', { - showContribution: true, - showIcons: true, - iconMode: 'tooltip', + quickSnapshot('only showExternalLinks', { + showExternalLinks: true, }); quickSnapshot('no accents', {}); - evaluate.snapshot('loads of links (inline)', { - name: 'linkContribution', - args: [ - {who: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [ - 'https://loremipsum.io', - 'https://loremipsum.io/generator/', - 'https://loremipsum.io/#meaning', - 'https://loremipsum.io/#usage-and-examples', - 'https://loremipsum.io/#controversy', - 'https://loremipsum.io/#when-to-use-lorem-ipsum', - 'https://loremipsum.io/#lorem-ipsum-all-the-things', - 'https://loremipsum.io/#original-source', - ]}, what: null}, - ], - slots: {showIcons: true}, - }); - - evaluate.snapshot('loads of links (tooltip)', { + evaluate.snapshot('loads of links', { name: 'linkContribution', args: [ - {who: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [ + {artist: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [ 'https://loremipsum.io', 'https://loremipsum.io/generator/', 'https://loremipsum.io/#meaning', @@ -91,14 +60,14 @@ testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => { 'https://loremipsum.io/#when-to-use-lorem-ipsum', 'https://loremipsum.io/#lorem-ipsum-all-the-things', 'https://loremipsum.io/#original-source', - ]}, what: null}, + ]}, annotation: null}, ], - slots: {showIcons: true, iconMode: 'tooltip'}, + slots: {showExternalLinks: true}, }); quickSnapshot('no preventWrapping', { - showContribution: true, - showIcons: true, + showAnnotation: true, + showExternalLinks: true, preventWrapping: false, }); }); diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js index f4138630..90c98f4b 100644 --- a/test/snapshot/linkExternal.js +++ b/test/snapshot/linkExternal.js @@ -20,35 +20,174 @@ testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => { }); const quickSnapshotAllStyles = (context, urls) => { - for (const style of ['platform', 'normal', 'compact']) { + for (const style of ['platform', 'handle']) { const message = `context: ${context}, style: ${style}`; quickSnapshot(message, urls, {context, style}); } }; + // Try to comprehensively test every regular expression + // (in `match` and extractions like `handle` or `details`). + + // Try to *also* represent a reasonable variety of what kinds + // of URLs appear throughout the wiki. (This should serve to + // identify areas which #external-links is expected to + // accommodate, regardless whether or not there is special + // attention given in the actual descriptors.) + + // For normal custom-domain matches (e.g. Mastodon), + // it's OK to just test one custom domain in the list. + + // Generally match the sorting order in externalLinkSpec, + // so corresponding and missing test cases are easy to locate. + quickSnapshotAllStyles('generic', [ + // platform: appleMusic + 'https://music.apple.com/us/artist/system-of-a-down/462715', + + // platform: artstation + 'https://www.artstation.com/eevaningtea', + 'https://witnesstheabsurd.artstation.com/', + + // platform: bandcamp + 'https://music.solatrus.com/', 'https://homestuck.bandcamp.com/', - 'https://soundcloud.com/plazmataz', - 'https://aeritus.tumblr.com/', - 'https://twitter.com/awkwarddoesart', + + // platform: bluesky + 'https://bsky.app/profile/jacobtheloofah.bsky.social', + + // platform: carrd + 'https://aliceflare.carrd.co', + 'https://bigchaslappa.carrd.co/', + + // platform: cohost + 'https://cohost.org/cosmoptera', + + // platform: deconreconstruction.music + 'https://music.deconreconstruction.com/albums/catch-322', + 'https://music.deconreconstruction.com/albums/catch-322?track=arcjecs-theme', + + // platform: deconreconstruction + 'https://www.deconreconstruction.com/', + + // platform: deviantart + 'https://culdhira.deviantart.com', 'https://www.deviantart.com/chesswanderlust-sama', - 'https://en.wikipedia.org/wiki/Haydn_Quartet_(vocal_ensemble)', - 'https://www.poetryfoundation.org/poets/christina-rossetti', - 'https://www.instagram.com/levc_egm/', - 'https://www.patreon.com/CecilyRenns', - 'https://open.spotify.com/artist/63SNNpNOicDzG3LY82G4q3', - 'https://buzinkai.newgrounds.com/', + 'https://www.deviantart.com/shilloshilloh/art/Homestuck-Jake-English-268874606', - // Just one custom domain of each platform is OK here - 'https://music.solatrus.com/', - 'https://types.pl/', + // platform: facebook + 'https://www.facebook.com/DoomedCloud/', + 'https://www.facebook.com/pages/WoodenToaster/280642235307371', + 'https://www.facebook.com/Svixy/posts/400018786702633', + + // platform: fandom.mspaintadventures + 'https://mspaintadventures.fandom.com/wiki/Draconian_Dignitary', + 'https://mspaintadventures.fandom.com/wiki/', + 'https://mspaintadventures.fandom.com/', + // platform: fandom 'https://community.fandom.com/', 'https://community.fandom.com/wiki/', 'https://community.fandom.com/wiki/Community_Central', - 'https://mspaintadventures.fandom.com/', - 'https://mspaintadventures.fandom.com/wiki/', - 'https://mspaintadventures.fandom.com/wiki/Draconian_Dignitary', + + // platform: gamebanana + 'https://gamebanana.com/members/2028092', + 'https://gamebanana.com/mods/459476', + + // platform: homestuck + 'https://homestuck.com/', + + // platform: hsmusic.archive + 'https://hsmusic.wiki/media/misc/archive/Firefly%20Cloud%20Remix.mp3', + + // platform: hsmusic + 'https://hsmusic.wiki/feedback/', + + // platform: internetArchive + 'https://archive.org/details/a-life-well-lived', + 'https://archive.org/details/VastError_Volume1/11+Renaissance.mp3', + + // platform: instagram + 'https://instagram.com/bass.and.noises', + 'https://www.instagram.com/levc_egm/', + + // platform: itch + 'https://tuyoki.itch.io/', + 'https://itch.io/profile/bravelittletoreador', + + // platform: ko-fi + 'https://ko-fi.com/gnaach', + + // platform: linktree + 'https://linktr.ee/bbpanzu', + + // platform: mastodon + 'https://types.pl/', + + // platform: mspfa + 'https://canwc.mspfa.com/', + 'https://mspfa.com/?s=12003&p=1045', + 'https://mspfa.com/user/?u=103334508819793669241', + + // platform: neocities + 'https://wodaro.neocities.org', + 'https://neomints.neocities.org/', + + // platform: newgrounds + 'https://buzinkai.newgrounds.com/', + 'https://www.newgrounds.com/audio/listen/1256058', + + // platform: patreon + 'https://www.patreon.com/CecilyRenns', + + // platform: poetryFoundation + 'https://www.poetryfoundation.org/poets/christina-rossetti', + 'https://www.poetryfoundation.org/poems/45000/remember-56d224509b7ae', + + // platform: soundcloud + 'https://soundcloud.com/plazmataz', + 'https://soundcloud.com/worthikids/1-i-accidentally-broke-my', + + // platform: spotify + 'https://open.spotify.com/artist/63SNNpNOicDzG3LY82G4q3', + 'https://open.spotify.com/album/0iHvPD8rM3hQa0qeVtPQ3t', + 'https://open.spotify.com/track/6YEGQH32aAXb9vQQbBrPlw', + + // platform: tiktok + 'https://www.tiktok.com/@richaadeb', + + // platform: toyhouse + 'https://toyhou.se/ghastaboo', + + // platform: tumblr + 'https://aeritus.tumblr.com/', + 'https://vol5anthology.tumblr.com/post/159528808107/hey-everyone-its-413-and-that-means-we-have', + 'https://www.tumblr.com/electricwestern', + 'https://www.tumblr.com/spellmynamewithabang/142767566733/happy-413-this-is-the-first-time-anyones-heard', + + // platform: twitch + 'https://www.twitch.tv/ajhebard', + 'https://www.twitch.tv/vargskelethor/', + + // platform: twitter + 'https://twitter.com/awkwarddoesart', + 'https://twitter.com/purenonsens/', + 'https://twitter.com/circlejourney/status/1202265927183548416', + + // platform: waybackMachine + 'https://web.archive.org/web/20120405160556/https://homestuck.bandcamp.com/album/colours-and-mayhem-universe-a', + 'https://web.archive.org/web/20160807111207/http://griffinspacejam.com:80/', + + // platform: wikipedia + 'https://en.wikipedia.org/wiki/Haydn_Quartet_(vocal_ensemble)', + + // platform: youtube + 'https://youtube.com/@bani-chan8949', + 'https://www.youtube.com/@Razzie16', + 'https://www.youtube.com/channel/UCQXfvlKkpbOqEz4BepHqK7g', + 'https://www.youtube.com/watch?v=6ekVnZm29kw', + 'https://youtu.be/WBkC038wSio', + 'https://www.youtube.com/playlist?list=PLy5UGIMKOXpONMExgI7lVYFwQa54QFp_H', ]); quickSnapshotAllStyles('album', [ diff --git a/test/snapshot/linkThing.js b/test/snapshot/linkThing.js index 502db6d7..9b5cff33 100644 --- a/test/snapshot/linkThing.js +++ b/test/snapshot/linkThing.js @@ -20,7 +20,7 @@ testContentFunctions(t, 'linkThing (snapshot)', async (t, evaluate) => { }); quickSnapshot('preferShortName', { - args: ['localized.tag', { + args: ['localized.artTagGallery', { directory: 'five-oceanfalls', name: 'Five (Oceanfalls)', nameShort: 'Five', diff --git a/test/snapshot/transformContent.js b/test/snapshot/transformContent.js index 87e337e4..63391681 100644 --- a/test/snapshot/transformContent.js +++ b/test/snapshot/transformContent.js @@ -156,6 +156,16 @@ testContentFunctions(t, 'transformContent (snapshot)', async (t, evaluate) => { `[[date:13 April 2004]], and don't ye forget it`, {mode: 'lyrics'}); + quickSnapshot( + 'emails', + `Email cute dogs to qznebula@protonmail.com please.\n` + + `Just kidding... [unless?](mailto:qznebula@protonmail.com)`); + + quickSnapshot( + `absorb punctuation`, + `Don't you think this is an [interesting pull request](https://github.com/hsmusic/hsmusic-wiki/pull/567), Steve?\n` + + `Aren't you [interested](https://github.com/hsmusic/hsmusic-wiki/pull/567)... in [checking it out](https://github.com/hsmusic/hsmusic-wiki/pull/567)?!!`); + // TODO: Snapshots for mode: inline // TODO: Snapshots for mode: single-link }); |