aboutsummaryrefslogtreecommitdiff
path: root/test/estimatedSchedule.test.ts
blob: 1e8e0860726b9170844d89f8d5adc7b1bc3765a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { expect, test } from "vitest";
import { HiAnime } from "aniwatch";

const padZero = (num: number) => (num < 10 ? `0${num}` : num.toString());

const d = new Date();
const date = `${d.getFullYear()}-${padZero(d.getMonth() + 1)}-${padZero(
  d.getDate()
)}`;

// npx vitest run estimatedSchedule.test.ts
test(`GET /api/v2/hianime/schedule?date=${date}`, async () => {
  const hianime = new HiAnime.Scraper();
  const data = await hianime.getEstimatedSchedule(date);

  expect(data.scheduledAnimes).not.toEqual([]);
});