test: fix failing nextEpisodeSchedule test case
This commit is contained in:
@@ -1,11 +1,20 @@
|
|||||||
import { expect, test } from "vitest";
|
import { expect, test } from "vitest";
|
||||||
import { HiAnime } from "aniwatch";
|
import { HiAnime } from "aniwatch";
|
||||||
|
|
||||||
|
function padZero(num: number) {
|
||||||
|
return num < 10 ? `0${num}` : num.toString();
|
||||||
|
}
|
||||||
|
|
||||||
// npx vitest run nextEpisodeSchedule.test.ts
|
// npx vitest run nextEpisodeSchedule.test.ts
|
||||||
test("returns anime next episode schedule", async () => {
|
test("returns anime next episode schedule", async () => {
|
||||||
const hianime = new HiAnime.Scraper();
|
const hianime = new HiAnime.Scraper();
|
||||||
|
|
||||||
const animeId = "one-piece-100";
|
const d = new Date();
|
||||||
|
const scheduleData = await hianime.getEstimatedSchedule(
|
||||||
|
`${d.getFullYear()}-${padZero(d.getMonth() + 1)}-${padZero(d.getDate())}`
|
||||||
|
);
|
||||||
|
|
||||||
|
const animeId = scheduleData.scheduledAnimes[0].id!;
|
||||||
const data = await hianime.getNextEpisodeSchedule(animeId);
|
const data = await hianime.getNextEpisodeSchedule(animeId);
|
||||||
|
|
||||||
expect(data.airingISOTimestamp).not.toEqual(null);
|
expect(data.airingISOTimestamp).not.toEqual(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user