« 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: 0d952f59e0db920b3f2ffb9c2a9ff11c887353f8 (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
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,
  });
});