Skip to content

Commit

Permalink
test(parseEpisode): add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
FlandreDaisuki committed Nov 5, 2023
1 parent 9cd1c8b commit 4b3424a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@
"i18n-ally.sourceLanguage": "zh",
"i18n-ally.displayLanguage": "zh",

"markdown.extension.toc.levels": "2..6"
"markdown.extension.toc.levels": "2..6",
"conventionalCommits.scopes": [
"parseEpisode"
]
}
2 changes: 1 addition & 1 deletion src/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const parseEpisode = (threadTitle, episodePatternString = '/$^/') => {
const BLACKLIST_PATTERNS = [
/x?(1080|720|480)p?/,
/^(\d+\s*)?\d+\s*$/,
/(\d+\s*)?\d+\s*/,
/(\d+\s*)?\d+\s*?/,
/x26[45]/,
/(10|8)bit/,
/ma10p/,
Expand Down
5 changes: 5 additions & 0 deletions tests/utils.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('parseEpisode', () => {
expect(parseEpisode('[澄空学园] 紫罗兰永恒花园 第08话 MP4 720p v2')).toMatchObject({ from: 8 });
expect(parseEpisode('【DHR百合組】[搖曳露營△_Yuru Camp][08][繁體][720P][MP4]')).toMatchObject({ from: 8 });
expect(parseEpisode('【西农YUI汉化组】★十月新番【三月的狮子 3-gatsu no Lion 2】第16话 GB简体 720P MP4')).toMatchObject({ from: 16 });
expect(parseEpisode('[猎户不鸽压制] 哥布林杀手 第二季 / Goblin Slayer II [04] [1080p] [繁日内嵌] [2023年10月番]')).toMatchObject({ from: 4 });
expect(parseEpisode('【喵萌奶茶屋&千夏字幕組】【輕旅輕營_Yuru Camp】[第08話][1280x720][MP4][繁體](諢名:搖曳露營)')).toMatchObject({ from: 8 });
expect(parseEpisode('[INDRA&NMKST][四月新番] 櫻花任務 / Sakura Quest [16] [720P][HardSub][BIG5][x264 AAC][v3]')).toMatchObject({ from: 16 });
expect(parseEpisode('【追新番字幕组】【3月的狮子】【Sangatsu no Lion】【第16集】【中日双语字幕】【HDTVrip】【1280X720】【mp4】')).toMatchObject({ from: 16 });
Expand Down Expand Up @@ -69,6 +70,10 @@ describe('parseEpisode', () => {
it('not support', () => {
expect(parseEpisode('[c.c動漫][8月][Fate Grand Order - 絕對魔獸戰線巴比倫尼亞][特別篇][BIG5][1080P][網盤]')).toMatchObject({});
});

it.todo('number in title', () => {
expect(parseEpisode('[SweetSub][16 位元的輝煌 Another Layer][16bit Sensation: Another Layer][03][WebRip][1080P][AVC 8bit][繁日雙語][v2](檢索用:16bit的感動)')).toMatchObject({ from: 3 });
});
// cSpell:enable
});

Expand Down

0 comments on commit 4b3424a

Please sign in to comment.