forked from tzuryby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 3
/
system_test.ts
59 lines (55 loc) · 1.5 KB
/
system_test.ts
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
import { assertEquals, sinon } from "./support/test_deps.ts";
import { faker } from "../mod.ts";
const { test } = Deno;
test({
name: "directoryPath() returns unix fs directory full path",
fn() {
sinon.stub(faker.random, "words").returns("24/7");
const directoryPath = faker.system.directoryPath();
assertEquals(
directoryPath.indexOf("/"),
0,
"generated directoryPath should start with /",
);
faker.random.words.restore();
},
});
test({
name: "filePath() returns unix fs file full path",
fn() {
sinon.stub(faker.random, "words").returns("24/7");
const filePath = faker.system.filePath();
assertEquals(
filePath.indexOf("/"),
0,
"generated filePath should start with /",
);
faker.random.words.restore();
},
});
test({
name: "fileName() returns filenames without system path seperators",
fn() {
sinon.stub(faker.random, "words").returns("24/7");
const fileName = faker.system.fileName();
assertEquals(
fileName.indexOf("/"),
-1,
"generated fileNames should not have path seperators",
);
faker.random.words.restore();
},
});
test({
name: "commonFileName() returns filenames without system path seperators",
fn() {
sinon.stub(faker.random, "words").returns("24/7");
const fileName = faker.system.commonFileName();
assertEquals(
fileName.indexOf("/"),
-1,
"generated commonFileNames should not have path seperators",
);
faker.random.words.restore();
},
});