From c336352a915245e28e08498de61808c96daa3dcf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 3 Dec 2023 17:49:20 -0400 Subject: test: generateTrackAdditionalNamesBox (snapshot) --- .../generateTrackAdditionalNamesBox.js.test.cjs | 99 +++++++++++++++++++ test/snapshot/generateTrackAdditionalNamesBox.js | 107 +++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 tap-snapshots/test/snapshot/generateTrackAdditionalNamesBox.js.test.cjs create mode 100644 test/snapshot/generateTrackAdditionalNamesBox.js diff --git a/tap-snapshots/test/snapshot/generateTrackAdditionalNamesBox.js.test.cjs b/tap-snapshots/test/snapshot/generateTrackAdditionalNamesBox.js.test.cjs new file mode 100644 index 00000000..3a22266e --- /dev/null +++ b/tap-snapshots/test/snapshot/generateTrackAdditionalNamesBox.js.test.cjs @@ -0,0 +1,99 @@ +/* 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/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > inferred additional names only 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ + [ + { name: 'Baz Baz', from: [ { directory: 'the-pyrenees' } ] } + ] + ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > multiple own 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ + [ + { name: 'Apple Time!' }, + { name: 'Pterodactyl Time!' }, + { name: 'Banana Time!' } + ] + ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > no additional names 1`] = ` + +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > own additional names only 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ [ { name: 'Foo Bar', annotation: 'the Alps' } ] ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > own and inferred, some overlap 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ + [ + { name: 'Ke$halo Strike Back', annotation: 'own annotation' }, + { name: 'Ironic Mania', annotation: 'own annotation' }, + { + name: 'ANARCHY::MEGASTRIFE', + from: [ { directory: 'inferred-from' } ] + } + ] + ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > own and shared and inferred, various overlap 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ + [ + { name: 'Own!', annotation: 'own annotation' }, + { name: 'Own! Shared!', annotation: 'own annotation' }, + { name: 'Own! Inferred!', annotation: 'own annotation' }, + { name: 'Own! Shared! Inferred!', annotation: 'own annotation' }, + { name: 'Shared!', annotation: 'shared annotation' }, + { name: 'Shared! Inferred!', annotation: 'shared annotation' }, + { name: 'Inferred!', from: [ { directory: 'inferred-from' } ] } + ] + ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > own and shared, some overlap 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ + [ + { name: 'weed dreams..', annotation: 'own annotation' }, + { name: '夜間のMOON汗', annotation: 'own annotation' }, + { name: 'GAMINGブラザー96', annotation: 'shared annotation' } + ] + ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > shared additional names only 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ [ { name: 'Bar Foo', annotation: 'the Rockies' } ] ] + slots: {}] +` + +exports[`test/snapshot/generateTrackAdditionalNamesBox.js > TAP > generateTrackAdditionalNamesBox (snapshot) > shared and inferred, some overlap 1`] = ` +[mocked: generateAdditionalNamesBox + args: [ + [ + { name: 'Coruscate', annotation: 'shared annotation' }, + { name: 'Arbroath', annotation: 'shared annotation' }, + { name: 'Prana Ferox', from: [ { directory: 'inferred-from' } ] } + ] + ] + slots: {}] +` diff --git a/test/snapshot/generateTrackAdditionalNamesBox.js b/test/snapshot/generateTrackAdditionalNamesBox.js new file mode 100644 index 00000000..9c1e3598 --- /dev/null +++ b/test/snapshot/generateTrackAdditionalNamesBox.js @@ -0,0 +1,107 @@ +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`}]}, + ], + }); +}); -- cgit 1.3.0-6-gf8a5