UNPKG

yt-dlx

Version:

Effortless Audio-Video Downloader And Streamer!

36 lines 1.81 kB
import channel_data from "../../../../routes/Search/Channel/Single"; import { Channel } from "youtubei"; import * as vitest from "vitest"; vitest.describe("channel_data", () => { const validChannelId = "UC-9-kyTW8ZkZNSB7LxqIENA"; const validChannelLink = `https://www.youtube.com/channel/${validChannelId}`; const invalidChannelLinkTooShort = "ab"; const nonexistentChannelLink = "https://www.youtube.com/channel/nonexistentchannel123"; vitest.it("should handle channel data fetch with a valid channel ID", async () => { try { const result = await channel_data({ channelLink: validChannelId }); vitest.expect(result).toHaveProperty("data"); vitest.expect(result.data).toBeInstanceOf(Channel); vitest.expect(result.data.id).toBe(validChannelId); vitest.expect(typeof result.data.name).toBe("string"); } catch (error) { console.warn(`Channel data fetch failed for ID "${validChannelId}". This test requires a real, existing channel ID.`, error); throw error; } }); vitest.it("should handle channel data fetch with a valid channel link", async () => { try { const result = await channel_data({ channelLink: validChannelLink }); vitest.expect(result).toHaveProperty("data"); vitest.expect(result.data).toBeInstanceOf(Channel); vitest.expect(result.data.id).toBe(validChannelId); vitest.expect(typeof result.data.name).toBe("string"); } catch (error) { console.warn(`Channel data fetch failed for link "${validChannelLink}". This test requires a real, existing channel link.`, error); throw error; } }); }); //# sourceMappingURL=Single.test.js.map