..
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 | import { describe, expect, it, vi } from 'vitest';
import { faker } from '../dist/cjs';
describe('database', () => {
describe('column()', () => {
it('returns a column name', () => {
const spy_database_column = vi
.spyOn(faker.database, 'column')
.mockReturnValue('title');
const column = faker.database.column();
const expected = 'title';
expect(
column,
'The column name should be equals ' +
expected +
'. Current is ' +
column
).toBe(expected);
spy_database_column.mockRestore();
});
});
describe('collation()', () => {
it('returns a collation', () => {
const spy_database_collation = vi
.spyOn(faker.database, 'collation')
.mockReturnValue('utf8_bin');
const collation = faker.database.collation();
const expected = 'utf8_bin';
expect(
collation,
'The collation should be equals ' +
expected +
'. Current is ' +
collation
).toBe(expected);
spy_database_collation.mockRestore();
});
});
describe('engine()', () => {
it('returns an engine', () => {
const spy_database_engine = vi
.spyOn(faker.database, 'engine')
.mockReturnValue('InnoDB');
const engine = faker.database.engine();
const expected = 'InnoDB';
expect(
engine,
'The db engine should be equals ' + expected + '. Current is ' + engine
).toBe(expected);
spy_database_engine.mockRestore();
});
});
describe('type()', () => {
it('returns a column type', () => {
const spy_database_type = vi
.spyOn(faker.database, 'type')
.mockReturnValue('int');
const type = faker.database.type();
const expected = 'int';
expect(
type,
'The column type should be equals ' + expected + '. Current is ' + type
).toBe(expected);
spy_database_type.mockRestore();
});
});
});
|
|