« get me outta code hell

reorganize test directory layout - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-27 09:59:43 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-03-27 09:59:43 -0300
commitcb13d591c6965dc52d89ec4d1e10558e6b22456b (patch)
treec2e13e0ae7ffc83327a176f40ea4101c9a5fb200
parent789a26aacfd1e9f97a9395f0000b42df35a75bd7 (diff)
reorganize test directory layout
Avoids unsavory "no tests found in _support.js" message
and makes structure match src directory layout more closely
-rw-r--r--package.json2
-rw-r--r--tap-snapshots/test/snapshot/linkArtist.js.test.cjs (renamed from tap-snapshots/test/snapshots/linkArtist.js.test.cjs)4
-rw-r--r--tap-snapshots/test/snapshot/linkTemplate.js.test.cjs (renamed from tap-snapshots/test/snapshots/linkTemplate.js.test.cjs)4
-rw-r--r--test/lib/content-function.js (renamed from test/snapshots/_support.js)0
-rw-r--r--test/snapshot/linkArtist.js (renamed from test/snapshots/linkArtist.js)2
-rw-r--r--test/snapshot/linkTemplate.js (renamed from test/snapshots/linkTemplate.js)2
-rw-r--r--test/unit/data/things/cacheable-object.js (renamed from test/cacheable-object.js)2
-rw-r--r--test/unit/data/things/track.js (renamed from test/things.js)2
-rw-r--r--test/unit/data/things/validators.js (renamed from test/data-validators.js)4
-rw-r--r--test/unit/util/html.js (renamed from test/html.js)2
10 files changed, 12 insertions, 12 deletions
diff --git a/package.json b/package.json
index 54417080..7f8e32e6 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
         "hsmusic": "./src/upd8.js"
     },
     "scripts": {
-        "test": "tap",
+        "test": "tap test/snapshot/*.js test/unit/**/*.js",
         "dev": "eslint src && node src/upd8.js"
     },
     "dependencies": {
diff --git a/tap-snapshots/test/snapshots/linkArtist.js.test.cjs b/tap-snapshots/test/snapshot/linkArtist.js.test.cjs
index 7ca52796..647742e0 100644
--- a/tap-snapshots/test/snapshots/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/snapshots/linkArtist.js TAP linkArtist > output 1`] = `
+exports[`test/snapshot/linkArtist.js TAP linkArtist > output 1`] = `
 <a href="artist/toby-fox/">Toby Fox</a>
 `
 
-exports[`test/snapshots/linkArtist.js TAP linkArtist > output 2`] = `
+exports[`test/snapshot/linkArtist.js TAP linkArtist > output 2`] = `
 <a href="artist/55gore/">55gore</a>
 `
diff --git a/tap-snapshots/test/snapshots/linkTemplate.js.test.cjs b/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs
index e3c3356b..4ca3e00f 100644
--- a/tap-snapshots/test/snapshots/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/snapshots/linkTemplate.js TAP linkTemplate > output 1`] = `
+exports[`test/snapshot/linkTemplate.js TAP linkTemplate > output 1`] = `
 <a class="dog" id="cat1" href="https://hsmusic.wiki/media/cool%20file.pdf#fooey" style="--primary-color: #123456ff; --dim-color: #12345677">My Cool Link</a>
 `
 
-exports[`test/snapshots/linkTemplate.js TAP linkTemplate > output 2`] = `
+exports[`test/snapshot/linkTemplate.js TAP linkTemplate > output 2`] = `
 <a href="/c*lzone/myCoolPath/ham/pineapple/tomato/index.html"></a>
 `
diff --git a/test/snapshots/_support.js b/test/lib/content-function.js
index b51f2847..b51f2847 100644
--- a/test/snapshots/_support.js
+++ b/test/lib/content-function.js
diff --git a/test/snapshots/linkArtist.js b/test/snapshot/linkArtist.js
index 43fee88e..383dcab2 100644
--- a/test/snapshots/linkArtist.js
+++ b/test/snapshot/linkArtist.js
@@ -1,6 +1,6 @@
 import t from 'tap';
 
-import {testContentFunctions} from './_support.js';
+import {testContentFunctions} from '../lib/content-function.js';
 
 testContentFunctions(t, 'linkArtist', (t, evaluate) => {
   evaluate.snapshot({
diff --git a/test/snapshots/linkTemplate.js b/test/snapshot/linkTemplate.js
index 0dcf5b61..6a629682 100644
--- a/test/snapshots/linkTemplate.js
+++ b/test/snapshot/linkTemplate.js
@@ -1,6 +1,6 @@
 import t from 'tap';
 
-import {testContentFunctions} from './_support.js';
+import {testContentFunctions} from '../lib/content-function.js';
 
 testContentFunctions(t, 'linkTemplate', (t, evaluate) => {
   evaluate.snapshot({
diff --git a/test/cacheable-object.js b/test/unit/data/things/cacheable-object.js
index 0dab9913..d7a88ce7 100644
--- a/test/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 '../../../../src/data/things/cacheable-object.js';
 
 function newCacheableObject(PD) {
   return new (class extends CacheableObject {
diff --git a/test/things.js b/test/unit/data/things/track.js
index df3a9f64..0dad0e62 100644
--- a/test/things.js
+++ b/test/unit/data/things/track.js
@@ -1,6 +1,6 @@
 import t from 'tap';
 
-import thingConstructors from '../src/data/things/index.js';
+import thingConstructors from '../../../../src/data/things/index.js';
 
 const {
   Album,
diff --git a/test/data-validators.js b/test/unit/data/things/validators.js
index a1f870d3..53cba063 100644
--- a/test/data-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 '../../../../src/util/sugar.js';
 
 import {
   // Basic types
@@ -31,7 +31,7 @@ import {
 
   // Compositional utilities
   oneOf,
-} from '../src/data/things/validators.js';
+} from '../../../../src/data/things/validators.js';
 
 function test(t, msg, fn) {
   t.test(msg, t => {
diff --git a/test/html.js b/test/unit/util/html.js
index 6ca5a833..c26d53b2 100644
--- a/test/html.js
+++ b/test/unit/util/html.js
@@ -1,6 +1,6 @@
 import t from 'tap';
 
-import * as html from '../src/util/html.js';
+import * as html from '../../../src/util/html.js';
 const {Tag, Attributes, Template, Slot} = html;
 
 t.test(`html.tag`, t => {