From 762be9d8078a2fd19a460b7172129a9575974f1f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 4 Apr 2023 13:44:07 -0300 Subject: test: tidy & add descriptions for existing snapshot tests --- .../snapshot/generateContributionLinks.js.test.cjs | 24 ++++++++--------- tap-snapshots/test/snapshot/linkArtist.js.test.cjs | 4 +-- .../test/snapshot/linkExternalFlash.js.test.cjs | 18 ++++--------- .../test/snapshot/linkTemplate.js.test.cjs | 4 +-- test/snapshot/generateContributionLinks.js | 8 +++--- test/snapshot/linkArtist.js | 6 ++--- test/snapshot/linkExternalFlash.js | 31 +++++++++------------- test/snapshot/linkTemplate.js | 6 ++--- 8 files changed, 43 insertions(+), 58 deletions(-) diff --git a/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs b/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs index 51e1ac86..0abd2d38 100644 --- a/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs +++ b/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs @@ -5,13 +5,21 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 1`] = ` +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > no accents 1`] = ` +Clark Powell, Grounder & Scratch, and Toby Fox +` + +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > only showContribution 1`] = ` +Clark Powell, Grounder & Scratch (Snooping), and Toby Fox (Arrangement) +` + +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > only showIcons 1`] = ` Clark Powell ( SoundCloud - ), Grounder & Scratch (Snooping), and Toby Fox (Arrangement) ( + ), Grounder & Scratch, and Toby Fox ( Bandcamp @@ -24,17 +32,13 @@ exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLink ) ` -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`] = ` +exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > showContribution & showIcons 1`] = ` Clark Powell ( SoundCloud - ), Grounder & Scratch, and Toby Fox ( + ), Grounder & Scratch (Snooping), and Toby Fox (Arrangement) ( Bandcamp @@ -46,7 +50,3 @@ exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLink ) ` - -exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 4`] = ` -Clark Powell, Grounder & Scratch, and Toby Fox -` diff --git a/tap-snapshots/test/snapshot/linkArtist.js.test.cjs b/tap-snapshots/test/snapshot/linkArtist.js.test.cjs index 647742e0..77516f3f 100644 --- a/tap-snapshots/test/snapshot/linkArtist.js.test.cjs +++ b/tap-snapshots/test/snapshot/linkArtist.js.test.cjs @@ -5,10 +5,10 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/snapshot/linkArtist.js TAP linkArtist > output 1`] = ` +exports[`test/snapshot/linkArtist.js TAP linkArtist (snapshot) > basic behavior 1`] = ` Toby Fox ` -exports[`test/snapshot/linkArtist.js TAP linkArtist > output 2`] = ` +exports[`test/snapshot/linkArtist.js TAP linkArtist (snapshot) > prefer short name 1`] = ` 55gore ` diff --git a/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs b/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs index e4d001a9..d7f6c1c3 100644 --- a/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs +++ b/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs @@ -5,22 +5,14 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 1`] = ` +exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > basic behavior 1`] = ` homestuck.com (page 4109) -` - -exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 2`] = ` -homestuck.com (secret page) -` - -exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 3`] = ` YouTube (on any device) -` - -exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 4`] = ` www.bgreco.net (HQ Audio) +Newgrounds ` -exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 5`] = ` -Newgrounds +exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > secret page 1`] = ` +homestuck.com (secret page) +YouTube (on any device) ` diff --git a/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs b/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs index 4ca3e00f..9063eace 100644 --- a/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs +++ b/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs @@ -5,10 +5,10 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/snapshot/linkTemplate.js TAP linkTemplate > output 1`] = ` +exports[`test/snapshot/linkTemplate.js TAP linkTemplate (snapshot) > fill many slots 1`] = ` My Cool Link ` -exports[`test/snapshot/linkTemplate.js TAP linkTemplate > output 2`] = ` +exports[`test/snapshot/linkTemplate.js TAP linkTemplate (snapshot) > fill path slot 1`] = ` ` diff --git a/test/snapshot/generateContributionLinks.js b/test/snapshot/generateContributionLinks.js index 10d225cd..deecf9ef 100644 --- a/test/snapshot/generateContributionLinks.js +++ b/test/snapshot/generateContributionLinks.js @@ -28,22 +28,22 @@ testContentFunctions(t, 'generateContributionLinks (snapshot)', async (t, evalua await evaluate.load(); - evaluate.snapshot({ + evaluate.snapshot('showContribution & showIcons', { name: 'generateContributionLinks', args: [contributions, {showContribution: true, showIcons: true}], }); - evaluate.snapshot({ + evaluate.snapshot('only showContribution', { name: 'generateContributionLinks', args: [contributions, {showContribution: true, showIcons: false}], }); - evaluate.snapshot({ + evaluate.snapshot('only showIcons', { name: 'generateContributionLinks', args: [contributions, {showContribution: false, showIcons: true}], }); - evaluate.snapshot({ + evaluate.snapshot('no accents', { name: 'generateContributionLinks', args: [contributions, {showContribution: false, showIcons: false}], }); diff --git a/test/snapshot/linkArtist.js b/test/snapshot/linkArtist.js index 633e2ae6..e479ece0 100644 --- a/test/snapshot/linkArtist.js +++ b/test/snapshot/linkArtist.js @@ -1,10 +1,10 @@ import t from 'tap'; import {testContentFunctions} from '../lib/content-function.js'; -testContentFunctions(t, 'linkArtist', async (t, evaluate) => { +testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => { await evaluate.load(); - evaluate.snapshot({ + evaluate.snapshot('basic behavior', { name: 'linkArtist', args: [ { @@ -14,7 +14,7 @@ testContentFunctions(t, 'linkArtist', async (t, evaluate) => { ], }); - evaluate.snapshot({ + evaluate.snapshot('prefer short name', { name: 'linkArtist', args: [ { diff --git a/test/snapshot/linkExternalFlash.js b/test/snapshot/linkExternalFlash.js index 3f63760f..7bb86c6a 100644 --- a/test/snapshot/linkExternalFlash.js +++ b/test/snapshot/linkExternalFlash.js @@ -4,28 +4,21 @@ import {testContentFunctions} from '../lib/content-function.js'; testContentFunctions(t, 'linkExternalFlash (snapshot)', async (t, evaluate) => { await evaluate.load(); - evaluate.snapshot({ + evaluate.snapshot('basic behavior', { name: 'linkExternalFlash', - args: ['https://homestuck.com/story/4109/', {page: '4109'}], + multiple: [ + {args: ['https://homestuck.com/story/4109/', {page: '4109'}]}, + {args: ['https://youtu.be/FDt-SLyEcjI', {page: '4109'}]}, + {args: ['https://www.bgreco.net/hsflash/006009.html', {page: '4109'}]}, + {args: ['https://www.newgrounds.com/portal/view/582345', {page: '4109'}]}, + ], }); - evaluate.snapshot({ + evaluate.snapshot('secret page', { name: 'linkExternalFlash', - args: ['https://homestuck.com/story/pony/', {page: 'pony'}], + multiple: [ + {args: ['https://homestuck.com/story/pony/', {page: 'pony'}]}, + {args: ['https://youtu.be/USB1pj6hAjU', {page: 'pony'}]}, + ], }); - - evaluate.snapshot({ - name: 'linkExternalFlash', - args: ['https://youtu.be/FDt-SLyEcjI', {page: '4109'}], - }); - - evaluate.snapshot({ - name: 'linkExternalFlash', - args: ['https://www.bgreco.net/hsflash/006009.html', {page: '4109'}], - }); - - evaluate.snapshot({ - name: 'linkExternalFlash', - args: ['https://www.newgrounds.com/portal/view/582345', {page: '4109'}], - }) }); diff --git a/test/snapshot/linkTemplate.js b/test/snapshot/linkTemplate.js index 10321897..07c3b501 100644 --- a/test/snapshot/linkTemplate.js +++ b/test/snapshot/linkTemplate.js @@ -1,10 +1,10 @@ import t from 'tap'; import {testContentFunctions} from '../lib/content-function.js'; -testContentFunctions(t, 'linkTemplate', async (t, evaluate) => { +testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => { await evaluate.load(); - evaluate.snapshot({ + evaluate.snapshot('fill many slots', { name: 'linkTemplate', extraDependencies: { getColors: c => ({primary: c + 'ff', dim: c + '77'}), @@ -17,7 +17,7 @@ testContentFunctions(t, 'linkTemplate', async (t, evaluate) => { .slot('attributes', {class: 'dog', id: 'cat1'}) .slot('content', 'My Cool Link')); - evaluate.snapshot({ + evaluate.snapshot('fill path slot', { name: 'linkTemplate', extraDependencies: { to: (...path) => '/c*lzone/' + path.join('/') + '/', -- cgit 1.3.0-6-gf8a5