« get me outta code hell

linkArtist.js « dependencies « content « unit « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit/content/dependencies/linkArtist.js
blob: e6e19d2f372ac5792a3aa46ed9a47f1bafa440f0 (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
import t from 'tap';
import {testContentFunctions} from '#test-lib';

testContentFunctions(t, 'linkArtist (unit)', async (t, evaluate) => {
  const artistObject = {};
  const linkTemplate = {};

  await evaluate.load({
    mock: evaluate.mock(mock => ({
      linkThing: {
        relations: mock.function('linkThing.relations', () => ({}))
          .args([undefined, 'localized.artist', artistObject])
          .once(),

        data: mock.function('linkThing.data', () => ({}))
          .args(['localized.artist', artistObject])
          .once(),

        generate: mock.function('linkThing.data', () => linkTemplate)
          .once(),
      }
    })),
  });

  const result = evaluate({
    name: 'linkArtist',
    args: [artistObject],
  });

  t.equal(result, linkTemplate);
});