From 0e7e812ac63813c04e4e4f0cb00f734a6f44dc46 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 29 Mar 2023 09:48:14 -0300 Subject: test: generateContributionLinks (snapshot) --- .../snapshot/generateContributionLinks.js.test.cjs | 52 ++++++++++++++++++++++ test/snapshot/generateContributionLinks.js | 50 +++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs create mode 100644 test/snapshot/generateContributionLinks.js diff --git a/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs b/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs new file mode 100644 index 00000000..51e1ac86 --- /dev/null +++ b/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs @@ -0,0 +1,52 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 1`] = ` +Clark Powell ( + + SoundCloud + + + ), Grounder & Scratch (Snooping), and Toby Fox (Arrangement) ( + + Bandcamp + + + , + + External (toby.fox) + + + ) +` + +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 2`] = ` +Clark Powell, Grounder & Scratch (Snooping), and Toby Fox (Arrangement) +` + +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 3`] = ` +Clark Powell ( + + SoundCloud + + + ), Grounder & Scratch, and Toby Fox ( + + Bandcamp + + + , + + External (toby.fox) + + + ) +` + +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 4`] = ` +Clark Powell, Grounder & Scratch, and Toby Fox +` diff --git a/test/snapshot/generateContributionLinks.js b/test/snapshot/generateContributionLinks.js new file mode 100644 index 00000000..10d225cd --- /dev/null +++ b/test/snapshot/generateContributionLinks.js @@ -0,0 +1,50 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'generateContributionLinks (snapshot)', async (t, evaluate) => { + const artist1 = { + name: 'Clark Powell', + directory: 'clark-powell', + urls: ['https://soundcloud.com/plazmataz'], + }; + + const artist2 = { + name: 'Grounder & Scratch', + directory: 'the-big-baddies', + urls: [], + }; + + const artist3 = { + name: 'Toby Fox', + directory: 'toby-fox', + urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'], + }; + + const contributions = [ + {who: artist1, what: null}, + {who: artist2, what: 'Snooping'}, + {who: artist3, what: 'Arrangement'}, + ]; + + await evaluate.load(); + + evaluate.snapshot({ + name: 'generateContributionLinks', + args: [contributions, {showContribution: true, showIcons: true}], + }); + + evaluate.snapshot({ + name: 'generateContributionLinks', + args: [contributions, {showContribution: true, showIcons: false}], + }); + + evaluate.snapshot({ + name: 'generateContributionLinks', + args: [contributions, {showContribution: false, showIcons: true}], + }); + + evaluate.snapshot({ + name: 'generateContributionLinks', + args: [contributions, {showContribution: false, showIcons: false}], + }); +}); -- cgit 1.3.0-6-gf8a5