From cb13d591c6965dc52d89ec4d1e10558e6b22456b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 27 Mar 2023 09:59:43 -0300 Subject: reorganize test directory layout Avoids unsavory "no tests found in _support.js" message and makes structure match src directory layout more closely --- test/snapshots/_support.js | 55 ---------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 test/snapshots/_support.js (limited to 'test/snapshots/_support.js') diff --git a/test/snapshots/_support.js b/test/snapshots/_support.js deleted file mode 100644 index b51f2847..00000000 --- a/test/snapshots/_support.js +++ /dev/null @@ -1,55 +0,0 @@ -import {quickEvaluate} from '../../src/content-function.js'; -import {quickLoadContentDependencies} from '../../src/content/dependencies/index.js'; - -import chroma from 'chroma-js'; -import * as html from '../../src/util/html.js'; -import urlSpec from '../../src/url-spec.js'; -import {getColors} from '../../src/util/colors.js'; -import {generateURLs} from '../../src/util/urls.js'; - -export function testContentFunctions(t, message, fn) { - const urls = generateURLs(urlSpec); - - t.test(message, async t => { - const loadedContentDependencies = await quickLoadContentDependencies(); - - const evaluate = ({ - from = 'localized.home', - contentDependencies = {}, - extraDependencies = {}, - ...opts - }) => { - const {to} = urls.from(from); - - try { - return quickEvaluate({ - ...opts, - contentDependencies: { - ...contentDependencies, - ...loadedContentDependencies, - }, - extraDependencies: { - html, - to, - urls, - appendIndexHTML: false, - getColors: c => getColors(c, {chroma}), - ...extraDependencies, - }, - }); - } catch (error) { - if (error instanceof AggregateError) { - error = new Error(`AggregateError: ${error.message}\n${error.errors.map(err => `** ${err}`).join('\n')}`); - } - throw error; - } - }; - - evaluate.snapshot = (opts, fn) => { - const result = (fn ? fn(evaluate(opts)) : evaluate(opts)); - t.matchSnapshot(result.toString(), 'output'); - }; - - return fn(t, evaluate); - }); -} -- cgit 1.3.0-6-gf8a5