From ef8acc5d50fa3c23bd7c9d4bb720b7ff78581981 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 19 Aug 2023 14:13:31 -0300 Subject: clean up imports & miscellaneous metastructures across codebase --- test/lib/content-function.js | 22 +++++++++++----------- test/lib/generic-mock.js | 2 +- test/lib/index.js | 3 +++ test/snapshot/generateAdditionalFilesList.js | 2 +- test/snapshot/generateAdditionalFilesShortcut.js | 2 +- test/snapshot/generateAlbumBanner.js | 2 +- test/snapshot/generateAlbumCoverArtwork.js | 2 +- test/snapshot/generateAlbumReleaseInfo.js | 2 +- test/snapshot/generateAlbumSecondaryNav.js | 2 +- test/snapshot/generateAlbumSidebarGroupBox.js | 2 +- test/snapshot/generateAlbumTrackList.js | 2 +- test/snapshot/generateBanner.js | 2 +- test/snapshot/generateCoverArtwork.js | 2 +- test/snapshot/generatePreviousNextLinks.js | 5 ++--- test/snapshot/generateTrackCoverArtwork.js | 2 +- test/snapshot/generateTrackReleaseInfo.js | 2 +- test/snapshot/image.js | 2 +- test/snapshot/linkArtist.js | 2 +- test/snapshot/linkContribution.js | 2 +- test/snapshot/linkExternal.js | 2 +- test/snapshot/linkExternalFlash.js | 2 +- test/snapshot/linkTemplate.js | 2 +- test/snapshot/transformContent.js | 2 +- .../content/dependencies/generateAlbumTrackList.js | 2 +- test/unit/content/dependencies/linkArtist.js | 2 +- test/unit/content/dependencies/linkContribution.js | 2 +- test/unit/data/things/cacheable-object.js | 2 +- test/unit/data/things/track.js | 3 +-- test/unit/data/things/validators.js | 4 ++-- test/unit/util/html.js | 6 +++--- 30 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 test/lib/index.js (limited to 'test') diff --git a/test/lib/content-function.js b/test/lib/content-function.js index a9e5f449..bb12be82 100644 --- a/test/lib/content-function.js +++ b/test/lib/content-function.js @@ -1,17 +1,17 @@ +import * as path from 'node:path'; +import {fileURLToPath} from 'node:url'; + import chroma from 'chroma-js'; -import * as path from 'path'; -import {fileURLToPath} from 'url'; + +import {getColors} from '#colors'; +import {quickLoadContentDependencies} from '#content-dependencies'; +import {quickEvaluate} from '#content-function'; +import * as html from '#html'; +import {processLanguageFile} from '#language'; +import {empty, showAggregate} from '#sugar'; +import {generateURLs, thumb, urlSpec} from '#urls'; import mock from './generic-mock.js'; -import {quickEvaluate} from '../../src/content-function.js'; -import {quickLoadContentDependencies} from '../../src/content/dependencies/index.js'; - -import urlSpec from '../../src/url-spec.js'; -import * as html from '../../src/util/html.js'; -import {empty, showAggregate} from '../../src/util/sugar.js'; -import {getColors} from '../../src/util/colors.js'; -import {generateURLs, thumb} from '../../src/util/urls.js'; -import {processLanguageFile} from '../../src/data/language.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); diff --git a/test/lib/generic-mock.js b/test/lib/generic-mock.js index 119f8731..28309ab0 100644 --- a/test/lib/generic-mock.js +++ b/test/lib/generic-mock.js @@ -1,6 +1,6 @@ import {same} from 'tcompare'; -import {empty} from '../../src/util/sugar.js'; +import {empty} from '#sugar'; export default function mock(callback) { const mocks = []; diff --git a/test/lib/index.js b/test/lib/index.js new file mode 100644 index 00000000..b9cc82f8 --- /dev/null +++ b/test/lib/index.js @@ -0,0 +1,3 @@ +export * from './content-function.js'; +export * from './generic-mock.js'; +export * from './strict-match-error.js'; diff --git a/test/snapshot/generateAdditionalFilesList.js b/test/snapshot/generateAdditionalFilesList.js index 60b46ae8..3ea1c37e 100644 --- a/test/snapshot/generateAdditionalFilesList.js +++ b/test/snapshot/generateAdditionalFilesList.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAdditionalFilesList (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateAdditionalFilesShortcut.js b/test/snapshot/generateAdditionalFilesShortcut.js index 0ca777b4..9825efa1 100644 --- a/test/snapshot/generateAdditionalFilesShortcut.js +++ b/test/snapshot/generateAdditionalFilesShortcut.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAdditionalFilesShortcut (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateAlbumBanner.js b/test/snapshot/generateAlbumBanner.js index e2260cdd..8e63308f 100644 --- a/test/snapshot/generateAlbumBanner.js +++ b/test/snapshot/generateAlbumBanner.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumBanner (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateAlbumCoverArtwork.js b/test/snapshot/generateAlbumCoverArtwork.js index 150b12bc..98632d39 100644 --- a/test/snapshot/generateAlbumCoverArtwork.js +++ b/test/snapshot/generateAlbumCoverArtwork.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumCoverArtwork (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateAlbumReleaseInfo.js b/test/snapshot/generateAlbumReleaseInfo.js index 7e3b37bd..3dea1196 100644 --- a/test/snapshot/generateAlbumReleaseInfo.js +++ b/test/snapshot/generateAlbumReleaseInfo.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumReleaseInfo (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateAlbumSecondaryNav.js b/test/snapshot/generateAlbumSecondaryNav.js index 180cb6e0..a5cb2e91 100644 --- a/test/snapshot/generateAlbumSecondaryNav.js +++ b/test/snapshot/generateAlbumSecondaryNav.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumSecondaryNav (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateAlbumSidebarGroupBox.js b/test/snapshot/generateAlbumSidebarGroupBox.js index 52348230..87850510 100644 --- a/test/snapshot/generateAlbumSidebarGroupBox.js +++ b/test/snapshot/generateAlbumSidebarGroupBox.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumSidebarGroupBox (snapshot)', async (t, evaluate) => { await evaluate.load({ diff --git a/test/snapshot/generateAlbumTrackList.js b/test/snapshot/generateAlbumTrackList.js index ea3cfef3..904ba98f 100644 --- a/test/snapshot/generateAlbumTrackList.js +++ b/test/snapshot/generateAlbumTrackList.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateBanner.js b/test/snapshot/generateBanner.js index 587ce04a..ab57c3cc 100644 --- a/test/snapshot/generateBanner.js +++ b/test/snapshot/generateBanner.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateBanner (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateCoverArtwork.js b/test/snapshot/generateCoverArtwork.js index 025a6d0d..21c91454 100644 --- a/test/snapshot/generateCoverArtwork.js +++ b/test/snapshot/generateCoverArtwork.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateCoverArtwork (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generatePreviousNextLinks.js b/test/snapshot/generatePreviousNextLinks.js index d0b61078..0d952f59 100644 --- a/test/snapshot/generatePreviousNextLinks.js +++ b/test/snapshot/generatePreviousNextLinks.js @@ -1,7 +1,6 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; - -import * as html from '../../src/util/html.js'; +import * as html from '#html'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generatePreviousNextLinks (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateTrackCoverArtwork.js b/test/snapshot/generateTrackCoverArtwork.js index bfefb5fb..9e154703 100644 --- a/test/snapshot/generateTrackCoverArtwork.js +++ b/test/snapshot/generateTrackCoverArtwork.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateTrackCoverArtwork (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/generateTrackReleaseInfo.js b/test/snapshot/generateTrackReleaseInfo.js index 5556f38b..c72344b9 100644 --- a/test/snapshot/generateTrackReleaseInfo.js +++ b/test/snapshot/generateTrackReleaseInfo.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateTrackReleaseInfo (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 62e1cd9a..6bec1cca 100644 --- a/test/snapshot/image.js +++ b/test/snapshot/image.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/linkArtist.js b/test/snapshot/linkArtist.js index 684affc3..7b2114b5 100644 --- a/test/snapshot/linkArtist.js +++ b/test/snapshot/linkArtist.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/linkContribution.js b/test/snapshot/linkContribution.js index ccb74674..ad5fb416 100644 --- a/test/snapshot/linkContribution.js +++ b/test/snapshot/linkContribution.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js index 391d5a10..3e8aee0d 100644 --- a/test/snapshot/linkExternal.js +++ b/test/snapshot/linkExternal.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/linkExternalFlash.js b/test/snapshot/linkExternalFlash.js index 7bb86c6a..a4d44aff 100644 --- a/test/snapshot/linkExternalFlash.js +++ b/test/snapshot/linkExternalFlash.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'linkExternalFlash (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/linkTemplate.js b/test/snapshot/linkTemplate.js index 83d77108..bdb91216 100644 --- a/test/snapshot/linkTemplate.js +++ b/test/snapshot/linkTemplate.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/snapshot/transformContent.js b/test/snapshot/transformContent.js index 96181e89..25952856 100644 --- a/test/snapshot/transformContent.js +++ b/test/snapshot/transformContent.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'transformContent (snapshot)', async (t, evaluate) => { await evaluate.load(); diff --git a/test/unit/content/dependencies/generateAlbumTrackList.js b/test/unit/content/dependencies/generateAlbumTrackList.js index 80b086ca..7b3ecd33 100644 --- a/test/unit/content/dependencies/generateAlbumTrackList.js +++ b/test/unit/content/dependencies/generateAlbumTrackList.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../../../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'generateAlbumTrackList (unit)', async (t, evaluate) => { await evaluate.load({ diff --git a/test/unit/content/dependencies/linkArtist.js b/test/unit/content/dependencies/linkArtist.js index 9fceb97d..e6e19d2f 100644 --- a/test/unit/content/dependencies/linkArtist.js +++ b/test/unit/content/dependencies/linkArtist.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../../../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; testContentFunctions(t, 'linkArtist (unit)', async (t, evaluate) => { const artistObject = {}; diff --git a/test/unit/content/dependencies/linkContribution.js b/test/unit/content/dependencies/linkContribution.js index bed2b6d5..94908901 100644 --- a/test/unit/content/dependencies/linkContribution.js +++ b/test/unit/content/dependencies/linkContribution.js @@ -1,5 +1,5 @@ import t from 'tap'; -import {testContentFunctions} from '../../../lib/content-function.js'; +import {testContentFunctions} from '#test-lib'; t.test('generateContributionLinks (unit)', async t => { const who1 = { diff --git a/test/unit/data/things/cacheable-object.js b/test/unit/data/things/cacheable-object.js index d7a88ce7..2e82af08 100644 --- a/test/unit/data/things/cacheable-object.js +++ b/test/unit/data/things/cacheable-object.js @@ -1,6 +1,6 @@ import t from 'tap'; -import CacheableObject from '../../../../src/data/things/cacheable-object.js'; +import {CacheableObject} from '#things'; function newCacheableObject(PD) { return new (class extends CacheableObject { diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js index 0dad0e62..383e3e3f 100644 --- a/test/unit/data/things/track.js +++ b/test/unit/data/things/track.js @@ -1,6 +1,5 @@ import t from 'tap'; - -import thingConstructors from '../../../../src/data/things/index.js'; +import thingConstructors from '#things'; const { Album, diff --git a/test/unit/data/things/validators.js b/test/unit/data/things/validators.js index 53cba063..bb33bf86 100644 --- a/test/unit/data/things/validators.js +++ b/test/unit/data/things/validators.js @@ -1,5 +1,5 @@ import t from 'tap'; -import { showAggregate } from '../../../../src/util/sugar.js'; +import {showAggregate} from '#sugar'; import { // Basic types @@ -31,7 +31,7 @@ import { // Compositional utilities oneOf, -} from '../../../../src/data/things/validators.js'; +} from '#validators'; function test(t, msg, fn) { t.test(msg, t => { diff --git a/test/unit/util/html.js b/test/unit/util/html.js index 9b30aeb3..b5956e67 100644 --- a/test/unit/util/html.js +++ b/test/unit/util/html.js @@ -1,9 +1,9 @@ import t from 'tap'; -import * as html from '../../../src/util/html.js'; -const {Tag, Attributes, Template} = html; +import * as html from '#html'; +import {strictlyThrows} from '#test-lib'; -import {strictlyThrows} from '../../lib/strict-match-error.js'; +const {Tag, Attributes, Template} = html; t.test(`html.tag`, t => { t.plan(14); -- cgit 1.3.0-6-gf8a5