/
web.test.ts
29 lines (24 loc) · 1 KB
/
web.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
import { test } from "@paperpod/common";
import { extractTextFromWeb } from "./web";
describe("extracting text", () => {
jest.mock("zombie");
it("Does mock zombie", async () => {
const content = extractTextFromWeb(test.mocks.article());
expect(content).toBeDefined();
});
it("Does extract text", async () => {
const textualData = await extractTextFromWeb(test.mocks.article());
expect(textualData.text).toBeTruthy(); //i.e. not empty string
expect(typeof textualData.text).toEqual("string");
});
it("Does extract title", async () => {
const textualData = await extractTextFromWeb(test.mocks.article());
expect(textualData.title).toBeTruthy(); //i.e. not empty string
expect(typeof textualData.title).toEqual("string");
});
it("Does extract author", async () => {
const textualData = await extractTextFromWeb(test.mocks.article());
expect(textualData.author).toBeTruthy(); //i.e. not empty string
expect(typeof textualData.author).toEqual("string");
});
});