« get me outta code hell

generatePreviousNextLinks.js « snapshot « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/generatePreviousNextLinks.js
blob: d0b61078b08a4f73f3d2431f57a0d7dd86c5431a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import t from 'tap';
import {testContentFunctions} from '../lib/content-function.js';

import * as html from '../../src/util/html.js';

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,
  });
});