aboutsummaryrefslogtreecommitdiff
path: root/test/modules/food.spec.ts
blob: 473a191b1c5b29479784072858f49e0556c37f67 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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('food', () => {
  seededTests(faker, 'food', (t) => {
    t.it('adjective');

    t.it('description');

    t.it('dish');

    t.it('ethnicCategory');

    t.it('fruit');

    t.it('ingredient');

    t.it('meat');

    t.it('spice');

    t.it('vegetable');
  });

  describe.each(times(NON_SEEDED_BASED_RUN).map(() => faker.seed()))(
    'random seeded tests for seed %i',
    () => {
      describe('adjective', () => {
        it(`should return random value from adjective array`, () => {
          const actual = faker.food.adjective();
          expect(faker.definitions.food.adjective).toContain(actual);
        });
      });

      describe('dish', () => {
        it(`should be a capitalized string`, () => {
          const actual = faker.food.dish();
          expect(actual[0]).toBe(actual[0].toUpperCase());
        });
      });

      describe('ethnicCategory', () => {
        it(`should return random value from ethnic_category array`, () => {
          const actual = faker.food.ethnicCategory();
          expect(faker.definitions.food.ethnic_category).toContain(actual);
        });
      });

      describe('fruit', () => {
        it(`should return random value from fruit array`, () => {
          const actual = faker.food.fruit();
          expect(faker.definitions.food.fruit).toContain(actual);
        });
      });

      describe('ingredient', () => {
        it(`should return random value from ingredient array`, () => {
          const actual = faker.food.ingredient();
          expect(faker.definitions.food.ingredient).toContain(actual);
        });
      });

      describe('meat', () => {
        it(`should return random value from meat array`, () => {
          const actual = faker.food.meat();
          expect(faker.definitions.food.meat).toContain(actual);
        });
      });

      describe('spice', () => {
        it(`should return random value from spice array`, () => {
          const actual = faker.food.spice();
          expect(faker.definitions.food.spice).toContain(actual);
        });
      });

      describe('vegetable', () => {
        it(`should return random value from vegetable array`, () => {
          const actual = faker.food.vegetable();
          expect(faker.definitions.food.vegetable).toContain(actual);
        });
      });
    }
  );
});