« 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/generatePreviousNextLinks.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshot/generatePreviousNextLinks.js')
-rw-r--r--test/snapshot/generatePreviousNextLinks.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/snapshot/generatePreviousNextLinks.js b/test/snapshot/generatePreviousNextLinks.js
new file mode 100644
index 0000000..0d952f5
--- /dev/null
+++ b/test/snapshot/generatePreviousNextLinks.js
@@ -0,0 +1,35 @@
+import t from 'tap';
+import * as html from '#html';
+import {testContentFunctions} from '#test-lib';
+
+testContentFunctions(t, 'generatePreviousNextLinks (snapshot)', async (t, evaluate) => {
+  await evaluate.load();
+
+  const quickSnapshot = (message, slots) =>
+    evaluate.snapshot(message, {
+      name: 'generatePreviousNextLinks',
+      slots,
+      postprocess: template => template.content.join('\n'),
+    });
+
+  quickSnapshot('basic behavior', {
+    previousLink: evaluate.stubTemplate('previous'),
+    nextLink: evaluate.stubTemplate('next'),
+  });
+
+  quickSnapshot('previous missing', {
+    nextLink: evaluate.stubTemplate('next'),
+  });
+
+  quickSnapshot('next missing', {
+    previousLink: evaluate.stubTemplate('previous'),
+  });
+
+  quickSnapshot('neither link present', {});
+
+  quickSnapshot('disable id', {
+    previousLink: evaluate.stubTemplate('previous'),
+    nextLink: evaluate.stubTemplate('next'),
+    id: false,
+  });
+});