forked from VueTubeApp/VueTube-Extractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.test.ts
71 lines (70 loc) · 2.65 KB
/
main.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
60
61
62
63
64
65
66
67
68
69
70
71
// const fetch = require("isomorphic-fetch"); // So that fetch is available in the test environment. This will not be needed if using node 18.
// import { YouTube } from "../src";
// import { getYoutubeVideoInfoTest, YoutubeVideoInfoErrorTest } from "./cases";
//
// // Mock
// import initialization from "../src/extractors/youtube/core/initializer";
//
// describe("YouTube test suite", () => {
// let globalYoutube: YouTube;
// beforeAll(async function () {
// globalYoutube = await new YouTube().init();
// });
//
// describe("initilization tests", () => {
// test("if init can handle error during initialization", async () => {
// jest.spyOn(console, "warn").mockImplementation(() => { }); // Supress console warns
// const mockInit = jest
// .spyOn(initialization.prototype, "buildAsync")
// .mockRejectedValue(new Error("test"));
// const youtube = new YouTube();
// await expect(youtube.init()).rejects.toThrow();
// expect(mockInit).toHaveBeenCalled();
// });
// });
//
// describe("getVideoInfo tests", () => {
// beforeAll(function () {
// jest.unmock("@vuetubeapp/http");
// });
// test.each(getYoutubeVideoInfoTest)(
// "if getVideoInfo works as expected",
// async function (testCase) {
// const result = await globalYoutube.getVideoDetails(testCase.input);
// expect(result).toMatchObject(testCase.expected);
// }
// );
// test.each(YoutubeVideoInfoErrorTest)(
// "if getVideoInfo handles errors correctly",
// async function (testCase) {
// await expect(
// globalYoutube.getVideoDetails(testCase.input)
// ).rejects.toThrow(testCase.expected as Error);
// }
// );
// });
//
// test("if home page can be fetched", async () => {
// const result = await globalYoutube.getHomePage();
// expect(result).toBeDefined();
// expect(result.continue).toBeDefined();
// const continued = await result.continue?.();
// expect(continued).toBeDefined();
// }, 30000);
//
// test("if search page can be fetched", async () => {
// const result = await globalYoutube.getSearchPage("LTT");
// expect(result).toBeDefined();
// expect(result.continue).toBeDefined();
// // const continued = await result.continue?.();
// // expect(continued).toBeDefined();
// }, 30000);
//
// test("if search suggestions can be fetched", async () => {
// const result = await globalYoutube.getSearchSuggestions("test");
// expect(result).toBeDefined();
// });
// });
test("tests on the old youtube extractor is now disabled as it is no longer maintained", () => {
expect(true).toBe(true);
});