/
zombie.ts
36 lines (30 loc) · 883 Bytes
/
zombie.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
import faker from "faker";
export default class Zombie {
private doneVisiting: boolean = false;
constructor(_options) {}
public visit(_url: string, callback: () => void) {
this.doneVisiting = true;
callback();
}
public html() {
if (!this.doneVisiting) {
throw `Should not have called HTML before done with visit`;
}
return `
<!DOCTYPE html>
<head>
<title>${faker.lorem.sentence()}</title>
<meta name="author" content="${faker.name.firstName()}"/>
</head>
<body>
<p>${faker.lorem.paragraphs()}</p>
<p>${faker.lorem.paragraphs()}</p>
<p>${faker.lorem.paragraphs()}</p>
<p>${faker.lorem.paragraphs()}</p>
<p>${faker.lorem.paragraphs()}</p>
<p>${faker.lorem.paragraphs()}</p>
</body>
</html>
`;
}
}