aboutsummaryrefslogtreecommitdiff
path: root/test/modules/music.spec.ts
blob: c422c290f5b0c8375546325b84b170b589d413a8 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { describe, expect, it } from 'vitest';
import { faker } from '../../src';
import { seededTests } from '../support/seeded-runs';
import { times } from './../support/times';

const NON_SEEDED_BASED_RUN = 5;

describe('music', () => {
  seededTests(faker, 'music', (t) => {
    t.itEach('album', 'artist', 'genre', 'songName');
  });

  describe.each(times(NON_SEEDED_BASED_RUN).map(() => faker.seed()))(
    'random seeded tests for seed %i',
    () => {
      describe('album()', () => {
        it('should return an album name', () => {
          const album = faker.music.album();

          expect(album).toBeTruthy();
          expect(album).toBeTypeOf('string');
          expect(faker.definitions.music.album).toContain(album);
        });
      });

      describe('artist()', () => {
        it('should return an artist', () => {
          const artist = faker.music.artist();

          expect(artist).toBeTruthy();
          expect(artist).toBeTypeOf('string');
          expect(faker.definitions.music.artist).toContain(artist);
        });
      });

      describe('genre()', () => {
        it('should return a genre', () => {
          const genre = faker.music.genre();

          expect(genre).toBeTruthy();
          expect(genre).toBeTypeOf('string');
          expect(faker.definitions.music.genre).toContain(genre);
        });
      });

      describe('songName()', () => {
        it('returns a random song name', () => {
          const songName = faker.music.songName();

          expect(songName).toBeTruthy();
          expect(songName).toBeTypeOf('string');
          expect(faker.definitions.music.song_name).toContain(songName);
        });
      });
    }
  );
});