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 --- test/snapshot/generateContributionLinks.js | 8 ++++---- test/snapshot/linkArtist.js | 6 +++--- test/snapshot/linkExternalFlash.js | 31 ++++++++++++------------------ test/snapshot/linkTemplate.js | 6 +++--- 4 files changed, 22 insertions(+), 29 deletions(-) (limited to 'test/snapshot') 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