-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,42 @@ | ||
import { TORRENT_LINK_TAG_REGEX } from "@/utils/misc"; | ||
import { it } from "vitest"; | ||
import { expect } from "vitest"; | ||
|
||
import { getTorrentLinkFromHTML } from "@/utils/misc"; | ||
|
||
describe("Torrent", () => { | ||
it("should match torrent link tag", () => { | ||
it("should match dmhy torrent link tag", () => { | ||
const torrentLinkTag = | ||
'<a href="//dl.dmhy.org/2024/01/23/66e247e9ed66b639a46f2472a2f9fd46f2025fec.torrent">[2024.01.24] プロジェクトセカイ カラフルステージ! feat.初音ミク ワンダーランズ×ショウタイム SEKAI ALBUM Vol.2 [MP3 320K]</a>'; | ||
const torrentLinkTag2 = | ||
'<strong>會員專用連接:</strong> <a href="http://dl.dmhy.org/2024/01/23/06abefc6121c0428b6abdddf1b24744fba6f3738.torrent">[MagicStar] SHUT UP EP07 [WEBDL] [1080p]【生】</a>'; | ||
const torrentLinkTag3 = | ||
'<a href="https://dl.dmhy.org/2024/01/23/7731c887aeb285ca0373a595c520b3b0cef448e1.torrent">【ASMR】舔耳朵♪[WAV/MP3/MP4]</a>'; | ||
|
||
expect(getTorrentLinkFromHTML(torrentLinkTag)).toEqual({ | ||
href: "//dl.dmhy.org/2024/01/23/66e247e9ed66b639a46f2472a2f9fd46f2025fec.torrent", | ||
title: | ||
"[2024.01.24] プロジェクトセカイ カラフルステージ! feat.初音ミク ワンダーランズ×ショウタイム SEKAI ALBUM Vol.2 [MP3 320K]", | ||
}); | ||
|
||
expect(getTorrentLinkFromHTML(torrentLinkTag2)).toEqual({ | ||
href: "http://dl.dmhy.org/2024/01/23/06abefc6121c0428b6abdddf1b24744fba6f3738.torrent", | ||
title: "[MagicStar] SHUT UP EP07 [WEBDL] [1080p]【生】", | ||
}); | ||
|
||
expect(getTorrentLinkFromHTML(torrentLinkTag3)).toEqual({ | ||
href: "https://dl.dmhy.org/2024/01/23/7731c887aeb285ca0373a595c520b3b0cef448e1.torrent", | ||
title: "【ASMR】舔耳朵♪[WAV/MP3/MP4]", | ||
}); | ||
}); | ||
|
||
it("should match mirror site torrent link tag", () => { | ||
const link1 = | ||
'<strong>會員專用連接:</strong> <a href="//dmhytorrents.b168.net\n/2023/12/11/61e671afe573d1de89dfbfc24e1cea86c2efac04.torrent">【喵萌奶茶屋】★10月新番★[腼腆英雄 / SHY][10][1080p][简日双语][招募翻译]</a>'; | ||
|
||
expect(torrentLinkTag.match(TORRENT_LINK_TAG_REGEX)).toBeTruthy(); | ||
expect(getTorrentLinkFromHTML(link1)).toEqual({ | ||
href: "//dmhytorrents.b168.net/2023/12/11/61e671afe573d1de89dfbfc24e1cea86c2efac04.torrent", | ||
title: | ||
"【喵萌奶茶屋】★10月新番★[腼腆英雄 / SHY][10][1080p][简日双语][招募翻译]", | ||
}); | ||
}); | ||
}); |