« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshot')
-rw-r--r--test/snapshot/linkArtist.js26
-rw-r--r--test/snapshot/linkTemplate.js28
2 files changed, 54 insertions, 0 deletions
diff --git a/test/snapshot/linkArtist.js b/test/snapshot/linkArtist.js
new file mode 100644
index 00000000..383dcab2
--- /dev/null
+++ b/test/snapshot/linkArtist.js
@@ -0,0 +1,26 @@
+import t from 'tap';
+
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'linkArtist', (t, evaluate) => {
+  evaluate.snapshot({
+    name: 'linkArtist',
+    args: [
+      {
+        name: `Toby Fox`,
+        directory: `toby-fox`,
+      }
+    ],
+  });
+
+  evaluate.snapshot({
+    name: 'linkArtist',
+    args: [
+      {
+        name: 'ICCTTCMDMIROTMCWMWFTPFTDDOTARHPOESWGBTWEATFCWSEBTSSFOFG',
+        nameShort: '55gore',
+        directory: '55gore',
+      },
+    ],
+  }, v => v.slot('preferShortName', true));
+});
diff --git a/test/snapshot/linkTemplate.js b/test/snapshot/linkTemplate.js
new file mode 100644
index 00000000..6a629682
--- /dev/null
+++ b/test/snapshot/linkTemplate.js
@@ -0,0 +1,28 @@
+import t from 'tap';
+
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'linkTemplate', (t, evaluate) => {
+  evaluate.snapshot({
+    name: 'linkTemplate',
+    extraDependencies: {
+      getColors: c => ({primary: c + 'ff', dim: c + '77'}),
+    },
+  },
+    v => v
+      .slot('color', '#123456')
+      .slot('href', 'https://hsmusic.wiki/media/cool file.pdf')
+      .slot('hash', 'fooey')
+      .slot('attributes', {class: 'dog', id: 'cat1'})
+      .slot('content', 'My Cool Link'));
+
+  evaluate.snapshot({
+    name: 'linkTemplate',
+    extraDependencies: {
+      to: (...path) => '/c*lzone/' + path.join('/') + '/',
+      appendIndexHTML: true,
+    },
+  },
+    v => v
+      .slot('path', ['myCoolPath', 'ham', 'pineapple', 'tomato']));
+});