« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tap-snapshots/test/snapshot/generateAlbumBanner.js.test.cjs18
-rw-r--r--tap-snapshots/test/snapshot/generatePageBanner.js.test.cjs14
-rw-r--r--test/snapshot/generateAlbumBanner.js34
-rw-r--r--test/snapshot/generatePageBanner.js22
4 files changed, 88 insertions, 0 deletions
diff --git a/tap-snapshots/test/snapshot/generateAlbumBanner.js.test.cjs b/tap-snapshots/test/snapshot/generateAlbumBanner.js.test.cjs
new file mode 100644
index 00000000..28eaf6d3
--- /dev/null
+++ b/tap-snapshots/test/snapshot/generateAlbumBanner.js.test.cjs
@@ -0,0 +1,18 @@
+/* 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/generateAlbumBanner.js TAP generateAlbumBanner (snapshot) > basic behavior 1`] = `
+<div id="banner"><img src="media/album-art/cool-album/banner.png" alt="album banner" width="800" height="200"></div>
+`
+
+exports[`test/snapshot/generateAlbumBanner.js TAP generateAlbumBanner (snapshot) > no banner 1`] = `
+
+`
+
+exports[`test/snapshot/generateAlbumBanner.js TAP generateAlbumBanner (snapshot) > no dimensions 1`] = `
+<div id="banner"><img src="media/album-art/cool-album/banner.png" alt="album banner" width="1100" height="200"></div>
+`
diff --git a/tap-snapshots/test/snapshot/generatePageBanner.js.test.cjs b/tap-snapshots/test/snapshot/generatePageBanner.js.test.cjs
new file mode 100644
index 00000000..fd84b074
--- /dev/null
+++ b/tap-snapshots/test/snapshot/generatePageBanner.js.test.cjs
@@ -0,0 +1,14 @@
+/* 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/generatePageBanner.js TAP generatePageBanner (snapshot) > basic behavior 1`] = `
+<div id="banner"><img src="media/album-art/cool-album/banner.png" alt="Very cool banner art." width="800" height="200"></div>
+`
+
+exports[`test/snapshot/generatePageBanner.js TAP generatePageBanner (snapshot) > no dimensions 1`] = `
+<div id="banner"><img src="media/album-art/cool-album/banner.png" width="1100" height="200"></div>
+`
diff --git a/test/snapshot/generateAlbumBanner.js b/test/snapshot/generateAlbumBanner.js
new file mode 100644
index 00000000..e2260cdd
--- /dev/null
+++ b/test/snapshot/generateAlbumBanner.js
@@ -0,0 +1,34 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'generateAlbumBanner (snapshot)', async (t, evaluate) => {
+  await evaluate.load();
+
+  evaluate.snapshot('basic behavior', {
+    name: 'generateAlbumBanner',
+    args: [{
+      directory: 'cool-album',
+      hasBannerArt: true,
+      bannerDimensions: [800, 200],
+      bannerFileExtension: 'png',
+    }],
+  });
+
+  evaluate.snapshot('no dimensions', {
+    name: 'generateAlbumBanner',
+    args: [{
+      directory: 'cool-album',
+      hasBannerArt: true,
+      bannerDimensions: null,
+      bannerFileExtension: 'png',
+    }],
+  });
+
+  evaluate.snapshot('no banner', {
+    name: 'generateAlbumBanner',
+    args: [{
+      directory: 'cool-album',
+      hasBannerArt: false,
+    }],
+  });
+});
diff --git a/test/snapshot/generatePageBanner.js b/test/snapshot/generatePageBanner.js
new file mode 100644
index 00000000..9ede9fce
--- /dev/null
+++ b/test/snapshot/generatePageBanner.js
@@ -0,0 +1,22 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'generatePageBanner (snapshot)', async (t, evaluate) => {
+  await evaluate.load();
+
+  evaluate.snapshot('basic behavior', {
+    name: 'generatePageBanner',
+    slots: {
+      path: ['media.albumBanner', 'cool-album', 'png'],
+      alt: 'Very cool banner art.',
+      dimensions: [800, 200],
+    },
+  });
+
+  evaluate.snapshot('no dimensions', {
+    name: 'generatePageBanner',
+    slots: {
+      path: ['media.albumBanner', 'cool-album', 'png'],
+    },
+  });
+});