« 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: 9fceb97d1a4181009bc76b4edb43cd47de9063e6 (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 '../../../lib/content-function.js';

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