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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
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('company', () => {
seededTests(faker, 'company', (t) => {
t.itEach(
'name',
'catchPhrase',
'buzzPhrase',
'catchPhraseAdjective',
'catchPhraseDescriptor',
'catchPhraseNoun',
'buzzAdjective',
'buzzVerb',
'buzzNoun'
);
});
describe.each(times(NON_SEEDED_BASED_RUN).map(() => faker.seed()))(
'random seeded tests for seed %i',
() => {
describe('name()', () => {
it('should return a random company name', () => {
const actual = faker.company.name();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
});
});
describe('catchPhrase()', () => {
it('should return phrase comprising of a catch phrase adjective, descriptor, and noun', () => {
const actual = faker.company.catchPhrase();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
const parts = actual.split(' ');
expect(parts.length).toBeGreaterThanOrEqual(3);
});
});
describe('buzzPhrase()', () => {
it('should return phrase comprising of a buzz, adjective, and noun', () => {
const actual = faker.company.buzzPhrase();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
const parts = actual.split(' ');
expect(parts.length).toBeGreaterThanOrEqual(3);
});
});
describe('catchPhraseAdjective()', () => {
it('should return random value from adjective array', () => {
const actual = faker.company.catchPhraseAdjective();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
expect(faker.definitions.company.adjective).toContain(actual);
});
});
describe('catchPhraseDescriptor()', () => {
it('should return random value from descriptor array', () => {
const actual = faker.company.catchPhraseDescriptor();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
expect(faker.definitions.company.descriptor).toContain(actual);
});
});
describe('catchPhraseNoun()', () => {
it('should return random value from noun array', () => {
const actual = faker.company.catchPhraseNoun();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
expect(faker.definitions.company.noun).toContain(actual);
});
});
describe('buzzAdjective()', () => {
it('should return random value from buzz_adjective array', () => {
const actual = faker.company.buzzAdjective();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
expect(faker.definitions.company.buzz_adjective).toContain(actual);
});
});
describe('buzzVerb()', () => {
it('should return random value from buzz_verb array', () => {
const actual = faker.company.buzzVerb();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
expect(faker.definitions.company.buzz_verb).toContain(actual);
});
});
describe('buzzNoun()', () => {
it('should return random value from buzz_noun array', () => {
const actual = faker.company.buzzNoun();
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
expect(faker.definitions.company.buzz_noun).toContain(actual);
});
});
}
);
});
|