-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.test.js
107 lines (100 loc) · 2.92 KB
/
index.test.js
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
import { config, readFile, applyConfig, writeFile } from "./index";
import { ssg_ } from "./index";
import { jest } from "@jest/globals";
describe("index", () => {
test("config input", async () => {
config.input = ssg_(`${config.input}`);
expect(config.input).toBe(ssg_(`${config.input}`));
});
test("config output", async () => {
config.output = ssg_(`${config.output}`);
expect(config.output).toBe(ssg_(`${config.output}`));
});
test("config lang", async () => {
config.lang = ssg_(`${config.input}`, `${config.lang}`);
expect(config.lang).toBe(ssg_(`${config.input}`, `${config.lang}`));
});
});
describe("file handling", () => {
test("read file", async () => {
const file = ssg_(`${config.input}`);
expect(file).toBe(ssg_(`${config.input}`));
});
test("write file", async () => {
const file = ssg_(`${config.input}`);
expect(file).toBe(ssg_(`${config.input}`));
});
test("generate index html", async () => {
const file = ssg_(`${config.input}`);
expect(file).toBe(ssg_(`${config.input}`));
});
});
describe("file handling with text files", () => {
test("read file", async () => {
const path = "./test.txt";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
test("write file", async () => {
const path = "./test.txt";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
test("generate index html", async () => {
const path = "./test.txt";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
});
describe("file handling with markdown files", () => {
test("read file", async () => {
const path = "./test.md";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
test("write file", async () => {
const path = "./test.md";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
test("generate index html", async () => {
const path = "./test.md";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
});
describe("index.html", () => {
test("index.html file", async () => {
const path = "./index.html";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
test("index.html file in dist folder", async () => {
const path = "./dist/index.html";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
});
describe("textfile folder", () => {
test("textfile folder exists", async () => {
const path = "./textfile";
const file = ssg_(path);
expect(file).toBe(ssg_(path));
});
});
// test for function readfile
describe("readfile", () => {
test("readfile", async () => {
const path = "test.txt";
const file = readFile(path);
expect(file).toStrictEqual(readFile(path));
});
});
//test for function applyConfig
describe("applyConfig", () => {
test("applyConfig", async () => {
const path = "config.json";
const file = applyConfig(path);
expect(file).toStrictEqual(applyConfig(path));
});
});